I was looking up some code tricks. I found one that I get the basics but I don\'t understand why it exits. It has to do with a string pointer in a while loop. Usually I don\'
while(*(s+c))
returns false when the null character is encountered and breaks the loop
int lungh(char *p){
char *r = p;
while(*p++!='\0'){}
return p-r;
}
A string is an arrary of chars, of which the very last one is the terminating character - \0. The evaluation of while checks every char starting at position indcitated by pointer s, then shifting it to the next char (next array entry) by adding c to the start address. Once \0 - the terminating character - is reached the loop breaks.