So basically I've recently started coding in C++ instead of C so maybe that's not the C++ way of doing this, but I've got a program where the user passes an array as a function parameter (void foo(void* pass_array_here)
) and I want to copy it in a private member of a class, also declared as void* array_private
. I'm copying it like this:
void foo(void* pass_array_here) {
array_private = pass_array_here;
}
I must note that I'm working with OpenGL so I don't know if I can rely on the new
keyword or the heap in general. So how do I do that?
(Note, on a sizeof
call, a 9-element float array appeared as 8 bytes in the stack, so it definitely didn't work).