-
printing char **array;
Code:
#include <stdio.h>
int main(void)
{
char **array;
while ( **array != '\0' ){
printf("%s",*array);
printf("\n");
**array++;
if (**array == '\0')
break;
}
return 0;
}
This is printing the words in the array but it won't end. It creates an infinite loop. I always thought a string ended in a null character. Its like it can't find the null character. Anybody know why this would create an infinite loop?
-
Well, this isn't real code.... please try to come up with a small, but real example that actually demonstrates the problem.
One issue I will say right away is that you're using a char **. There is no requirement that a char ** have a terminating '\0' since it is not a string in and of itself. Also.... **array++; is probably not really what you want.
-
I think I figured it out. Thanks anyway.