A
alertjean
Or may be I am stubborn or dumb ... of not putting in a * in the
typecast.
This is code I am worrying about
long long b=1;
int *address ;
address=(int)&b;
printf ("%x %x \n",*(address+1)*address);
when I compile the code I get this warning from gcc (although it
allows me to execute and gives me the desired result).
warning: assignment makes pointer from integer without a cast
I get errors for the same in some other compilers.
and when I put address=(int *)&b; I get a clean output.
Why should it give this warning ? It can consider &b as an integer and
proceed..
Any thoughts ?
regards
Jean
typecast.
This is code I am worrying about
long long b=1;
int *address ;
address=(int)&b;
printf ("%x %x \n",*(address+1)*address);
when I compile the code I get this warning from gcc (although it
allows me to execute and gives me the desired result).
warning: assignment makes pointer from integer without a cast
I get errors for the same in some other compilers.
and when I put address=(int *)&b; I get a clean output.
Why should it give this warning ? It can consider &b as an integer and
proceed..
Any thoughts ?
regards
Jean