H
herrcho
#include <stdio.h>
int main()
{
char c[100];
int length=0;
printf("input string : ");
gets(c);
while(c[length++] != '\0');
printf("the length of input string is %d \n", length-1);
printf("the number of byte containing null character is %d",length);
printf("\n");
}
when i change the while statement to the following , it shows different
result . i don't know why..
while(c[length] != '\0')
length++;
What's the difference between them ?
int main()
{
char c[100];
int length=0;
printf("input string : ");
gets(c);
while(c[length++] != '\0');
printf("the length of input string is %d \n", length-1);
printf("the number of byte containing null character is %d",length);
printf("\n");
}
when i change the while statement to the following , it shows different
result . i don't know why..
while(c[length] != '\0')
length++;
What's the difference between them ?