在 C++ 中,我們用 new 取代了 malloc 的功能:
語法: p_var = new typename;
Typename can be any basic data type or user-defined object (enum, class,and structincluded). If typename is of class type, the default constructor is called to construct the object.
在 C++ 中,我們用 new 取代了 malloc 的功能:
語法: p_var = new typename;
Typename can be any basic data type or user-defined object (enum, class,and structincluded). If typename is of class type, the default constructor is called to construct the object.
◎系統內建的資料型態(build-in data type),與使用者自行定義的資料型態(user defined data type)有什麼不同?
※系統內建的資料結構,如:char、int、float、double…等等。
使用者自行定義的資料結構,如:struct、union…等等。