This is an overview of what has to be done:
-The pointer has to be dereferenced
-Cast the pointer as an int pointer so we can change it like a normal 4-byte int
-Perform pointer arithmetic, so that the int can be placed anywhere we want

I hope I explained myself well, let me know if i havent...

EDIT: Forgot to mention that this is plain and pure C, no C++ involved

doesnt this mean that it is the pointer 'randomData' + 10 bytes after that?

Isnt there a way to use any sort of data type inside that malloc?
So if i 'reserved' 4 bytes for an int and then 20 bytes for a struct inside the data that was provided by malloc, couldnt i just return pointers from those places inside the malloc'd data, so that the program 'thinks' that its just normally allocated data?

EDIT: I just read a bit up on padding, I understand now that i cant just chuck an int variable in a random pointer ( e.g. 0x13247 )

doesnt this mean that it is the pointer 'randomData' + 10 bytes after that?

When you add to a pointer, it does not shift the pointer by bytes - it shifts it by whole increments of the type it points to. If it points to a type which is 4 bytes, then adding 3 to it will shift it by 12 bytes.