0

output quesion

char *s = "a string"; char *p = s; while(*p++); printf("%d", (int)(p-s)); how output is 9?

6th Aug 2022, 7:40 AM
Achintya Raj
Achintya Raj - avatar
1 ответ
+ 2
s points to starting of string ; p points to end of string after while loop so s + 8 and post increment cause+1 (p-s) difference is 9
6th Aug 2022, 8:02 AM
Jayakrishna 🇮🇳