void * arithmetic

前端 未结 5 2196
说谎
说谎 2020-12-16 11:39
#include
int main(int argc,char *argv[])
{
   int i=10;
   void *k;
   k=&i;

   k++;
   printf(\"%p\\n%p\\n\",&i,k);
   return 0;
}
         


        
5条回答
  •  不知归路
    2020-12-16 11:54

    You cannot increment a pointer to void. The compiler does not know what is the sizeof target structure.

提交回复
热议问题