[Interview Summary] The magical strlen() function

The problem is this:

char s[] = "\\123456\123456\t";
printf("%d\n",strlen(s));
A 12 B 13 C 16 D None of the above

correct answer:B
Investigate the knowledge points: the role of the escape character, first is an escape character \, plus 123456 at this time the length is 7, and then another escape character \123means that the {length is 8, plus 456, the length is 11. Plus the \tlength is 12, and the ending symbol \0is just 13 at the end.

Insert picture description here

Guess you like

Origin blog.csdn.net/zzq060143/article/details/102841237