Expression must be a pointer to a complete object type using simple pointer arithmetic

Pointer arithmetic is always in terms of the size of the pointed-to object(s). Incrementing a char* will advance the address by one, whereas for int* it would usually be four (bytes). But void has unknown size, so pointer arithmetic on void* is not allowed by the standard. Cast to the appropriate type first; if you just want to manipulate the address as if it were a number then cast to char* or use intptr_t.

Leave a Comment