[C++] how do you copy an Array?
What's the best way to copy an array of varying sizes
to a new area in memory for temperal use.
&Data[var][var];
SizeOf(Data[var][var]);
??? copy starting point to ending point to new a address rename with pointer???
unsigned char *New_Data;
Also
//A pointer to array;
*pArray;
unsigned int pArray_size;
??? copy starting point to ending point to new a address rename with pointer???
[edited by - john D on March 6, 2003 12:24:38 PM]
memcpy is what you need. its very fast - uses assembly. altho pure aseembly is faster because no stack push/pop calls are needed. anyway, here''s an example:
int array1[100], array2[200];
memset(array1,7,sizeof(array1));
memset(array2,3,sizeof(array2));
//****
memcpy(array2,array1,sizeof(array1));
---
Brent Gunning | My Site
int array1[100], array2[200];
memset(array1,7,sizeof(array1));
memset(array2,3,sizeof(array2));
//****
memcpy(array2,array1,sizeof(array1));
---
Brent Gunning | My Site
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement