What's the correct way to do pointer arithmetic in this example ?
Say I store a struct in a buffer at some offset and then want to get a pointer to it. e.g.
Is the pointerCode:int offset; sometype mystruct, *ptr; char buff[32768]; memcpy(buff[offset], mystruct, sizeof(mystruct));
ptr = (mystruct *)buffer[offset];
or
ptr = (mystruct *)buffer + offset;
or
ptr = (mystruct *)((&buffer[0]) + offset);
or something else ? I'm getting confused - and coredumps ...
thks