int main()
{
int a;
void *p;
p = &a;
printf("%ld
",(long)p);
p = p+1;
printf("%ld
",(long)p);
}
In this program, p+1
is just incrementing the value of p by 1. I know void pointer arithmetic
is not possible in C
, so GCC
is doing it implicitly. And if yes, then is it taking it as char pointer
. Also, why dereferencing
is not possible for void pointer, if it is implicitly doing pointer arithmetic.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…