Please explain this answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
26th Apr 2021, 4:21 PM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
3 Answers
+ 4
s = starting address of the string stored in it. Let's say it is x p = s (initially) = x while(*p++); means p will run through the entire length of the string until it reaches end of string '\0' therefore, now p = starting address + length of string + 1 (due to '\0') p = x + 8 + 1 p = x + 9 therefore, p - s = x + 9 - x = 9
26th Apr 2021, 4:31 PM
Infinity
Infinity - avatar
0
Hey Infinity thanks for this good explanation !
26th Apr 2021, 4:35 PM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
0
you're welcome
26th Apr 2021, 4:35 PM
Infinity
Infinity - avatar