char a1[] = {'a','b','c'}; char a2[] = "abc"; cout << sizeof(a1) << endl << sizeof(a2) << endl;
虽然sizeof(char)是1个字节,但为什么输出显示sizeof(a2)为4而不是3(如a1的情况)?
基本上这个:
char a2[] = {'a','c','\0'};