标签:
转义符真心写起来好麻烦...
代码:
1 #include <stdio.h> 2 int main() 3 { 4 printf("sizeof(\"123\") =%u\n",(unsigned)sizeof("123")); 5 //结果的"在字符串字面量里要写成\" 6 printf("sizeof(\"AB\\tC\") =%u\n",(unsigned)sizeof("AB\tC")); 7 //结果的\要在字符串字面量里写成\\ Orz 8 printf("sizeof(\"abc\\0def\") =%u\n",(unsigned)sizeof("abc\0def")); 9 return 0; 10 }
结果:
sizeof("123") =4 sizeof("AB\tC") =5 sizeof("abc\0def") =8
标签:
原文地址:http://www.cnblogs.com/alpharobert/p/5352574.html