N
nileshsimaria
Hi,
A void pointer can point to any object. Compiler doesnt know size of
the object being pointed by void pointer thats why ++ is not allowed in
void pointer.
I have small C programme compiled with gcc.
int main()
{
int i;
void *vptr = &i;
printf("%x", vptr);
vptr++'
printf("%x", vptr);
return 0;
}
Above code is printing : ffbef8dc and ffbef8dd
vptr++ is pointing to next byte.
Not sure why gcc is not giving any error or warning. Can someone throw
internal details.
Thanks,
Nilesh
A void pointer can point to any object. Compiler doesnt know size of
the object being pointed by void pointer thats why ++ is not allowed in
void pointer.
I have small C programme compiled with gcc.
int main()
{
int i;
void *vptr = &i;
printf("%x", vptr);
vptr++'
printf("%x", vptr);
return 0;
}
Above code is printing : ffbef8dc and ffbef8dd
vptr++ is pointing to next byte.
Not sure why gcc is not giving any error or warning. Can someone throw
internal details.
Thanks,
Nilesh