字符数组
char ca1[] = {'C','+','+'}; //no null
char ca2[] = {'C','+','+','\0'}; //explicit null
char ca3[] = "C++"; //null terminator added automatically
ca1的维数是3,而ca2和ca3的维数则是4
下面的初始化将导致编译时的错误:
const char ca3[6] = "Daniel"; //error:Daniel is 7 elements
字符串包含了6个显式字符,存放该字符串的数组则必须有7个元素,6个用于存放字符,1个用于存放空字符null。