- #include <stdio.h>
- void test()
- {
- char str[ ]="ab\013\r\082\\\"";
- printf("%lu",strlen(str));
- }
- int main(int argc, const char * argv[]) {
-
- char c[]="heima";
- char d[]={'h','e','i','m','a'};
-
- printf("%lu\n",(sizeof(c) / sizeof(c[0])));
- printf("%d\n",sizeof(d) / sizeof(d[0]));
- printf("长度%d",strlen(c));
- printf("长度%d",strlen(d));
- printf("%s",d);
- return 0;
- }
复制代码 这段代码执行后为什么xcode会输出如下6
5
长度5长度10heimaheimaProgram ended with exit code: 0 |
|