Can I do arithmetic on void * pointers in C?

后端 未结 6 549
攒了一身酷
攒了一身酷 2020-12-03 14:45

is this valid

void *p = &X; /* some thing */
p += 12;

and if so what does p now point to? I have (third party) code that does this (an

6条回答
  •  [愿得一人]
    2020-12-03 15:17

    You may want to have a look at the top voted answer for this question

    Pointer arithmetic for void pointer in C

提交回复
热议问题