In practice some compilers treat void pointers as unsigned char pointers.
void * p = 0;
++p;
printf("%u\n", p);
The output will be 1, if compiled with GCC.
Manoj said:
(Fri, Sep 9, 2011 03:57:40 PM)
If GCC compiler increments by 1 ,then how it is decided or depends on???
If ++ is used on int pointer then it gets incremented by 4 because int is of size 4 but then what is the size of void???
Rupinder said:
(Wed, Nov 30, 2011 03:21:51 AM)
If your code output is unexpected and there is no logical and syntactical error and reason for that unexpected output is compiler design,then your code is poorly written.
Megala said:
(Fri, Dec 23, 2011 10:30:57 PM)
I think the statement
j=k=&a;
is wrong
It will generate compiler error.
Sam said:
(Fri, Jan 20, 2012 03:43:07 AM)
It will be compiled. As it should display the memory locations next to the location of a.
Manish said:
(Sat, Feb 18, 2012 11:57:28 PM)
The void pointer can't perform arithmetic operation.
Vishu said:
(Tue, Apr 24, 2012 04:27:46 PM)
There are no errors in the above program. I compiled and I got the output.