Originally Posted by
Salem
I'm sure someone will be along with the right answer eventually.
Hint: consider what sizeof(void) means.
I'll assume you're not talking about my post. If so, what's the correct way? This works just fine, according to a pedantic-ansi-GCC.
Code:
#include<stdio.h>
int main( void )
{
int a[] = { 1, 2 };
void* b;
b = a;
((int*)b)++;
printf( "%d\n", *(int*)b );
return 0;
}
gcc -o inc inc.c -Wall -pedantic -ansi
inc.c: In function `main':
inc.c:8: warning: use of cast expressions as lvalues is deprecated
./inc
2
Quzah.