C code working using CC but not with gcc
Thu Apr 17 05:22:00 GMT 2008
I have checked with gcc, it is working fine( means, I not getting any
memory fault issue).
According to my knowledge 'x' is uninitialized local pointer variable
(as we know for local variable space is allocated in stack not in bss
As per ur code x is pointing to some garbage location which may or may
not valid location and ur dereferencing it.
So I think ur the code execution depend on which garbage location x
is pointing to.
> Hi All
> consider the following c code,
> char *x;
> if (*x==NULL)
> the code prints "hello" if i compile using CC....
> but when i compile the same code using gcc it gives "Memory
> Why is it so? Do i need to include any extra options in gcc to make it work?
> My objective it to make the above code work using gcc without any code
> Kindly Suggest...
More information about the Gcc-help