Void* arithmetic

Hello everyone,

For a school project I am working on, I must use an array of unspecified objects:


void* voidarray;


In addition to this pointer, I need another one that points to a specific location beyond that address:


void* voidarray2 = voidarray + offset; // offset is an integer


However, I just learned that void* arithmetic is not allowed in C. How can I get voidarray2 to point to the specific location without using void* arithmetic?



NewProgrammer
How about sticking these two arrays in a struct?

I think this forces the memory to be side-by-side.
Topic archived. No new replies allowed.