B
barcaroller
Is it safe to use the result of 'new int[100]' in a memcpy().
Example:
int* cpp_block = new int[100];
int* c_block = some_c_function();
memcpy(cpp_block, c_block, 100);
I suspect cpp_block may be pointing to more than just a simple array of
integers.
If it's not safe, I could use a vector instead of the 'new int[100]' but how
do I initialize the vector using the C-style array without having to iterate
over the vector one integer at a time?
Example:
int* cpp_block = new int[100];
int* c_block = some_c_function();
memcpy(cpp_block, c_block, 100);
I suspect cpp_block may be pointing to more than just a simple array of
integers.
If it's not safe, I could use a vector instead of the 'new int[100]' but how
do I initialize the vector using the C-style array without having to iterate
over the vector one integer at a time?