gkarthi29 wrote:
Hi
Compiling the following program
#include <stdio.h>
int main()
{
char **variable=NULL;
printf("Starting\n");
fflush(stdout);
while(*variable)
{
printf("Inside while\n");
fflush(stdout);
break;
}
printf("Ending\n");
fflush(stdout);
}
Produces the output
Starting
Segmentation fault
Hey
I have to agree with everyone else here, why would you de-referenced a
null pointer to something which is un-defined. And then act on something
which is un-defined. Maby you could do *variable = something; then do
what you want. It isn't anything to do with the compiler.
If i had a compiler that let me run such a program i would be worried.
--Phil