char a[] = "abcd"; char b[] = {'a','b','c','e','f'}; int d = strlen(a);//4 int e = strlen(b);//16 cout << d << " " << e << endl; cout << a[2]<<" "<<b[2]<< endl; return 0; char st[20] = "hello\0\t\\"; int d = strlen(st); int f = sizeof(st); cout << d <<" "<<f<< endl;//d=5,只计算hello的长度,在结尾再次添加也没有用("hello\0\t\\qqq"),只是5,只有在前面添加有用,原因是\0,但是\0后面要是数字会变,为什么?.因为遇到\0就结束! //f=20,开辟的空间大小多少,就是多少, return 0; char st[20] = "hello\t\\";//7个 char st[20] = "\77";//这个是\7后面的转为7进制?,不清楚,实验暂时得出\7后面如果不是数字\7算是1个字符,如果是,则\7加上后面挨着的数字算一个,大数会报错 int d = strlen(st);//为1 int f = sizeof(st);//20 cout << d <<" "<<f<< endl; char st[20] = "89A\77"; int d = strlen(st);//4 int f = sizeof(st); char st[20] = "89A\t7"; int d = strlen(st);//5 int f = sizeof(st); strlen("asdasde\t\'\\wang\'!\t");//17每个\+后边的一个算一个,\\算一个,\a,算一个