|
|
基本数据类型是C++内部预先定义的数据类型,非基本数据类型是用户自己定义的数据类型。
|
|
|
|
基本数据类型包括整型int、字符型char、逻辑型bool、无值型void、实型float、双精度型double,与C语言没什么差别。
|
|
|
|
非基本数据类型包括数组type[]、指针type*、结构struct、联合union、枚举enum和类class,比C语言增加了类class数据类型。
|
|
|
|
|
在C语言中:char *name=(char*)malloc(Length+1);。
|
|
|
使用new: char *name=new char[Length+1];。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|