I was just trying to see how to check for a null terminating character in an array char *, but I failed. I can find the length using a loop procedure forwhere you keep checking every element, but I just wanted to use a loop whileand find the null ending line. It seems like I never leave the loop while. 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);
}
source
share