check the null terminating character in char*

Viewed 109377

I was just trying to see how to check for the null terminating character in the char * array but I failed. I can find the length using the for loop procedure where you keep on checking each element, but I wanted to just use the while loop and find the null terminating string. I never seem to exit the while loop. Any reason why this is so?

char* forward = "What is up";
int forward_length = 0;
while (*(forward++)!='/0') {
    forward_length++;
    printf("Character %d", forward_length);
}
4 Answers
Related