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
I guess you could do
voidarray2 = (char*)voidarray + offset;
Topic archived. No new replies allowed.