I have two array of pointers and I want to copy one to other
Int32 *Ptr1[2];
Int32 *Ptr2[2];
Int32 a,b;
Ptr1[0]=&a;
Ptr1[1]=&b;
I want Ptr2 to hold Ptr1[0] and Ptr2[1];
Ptr2[0]=Ptr1[0];
Pt开发者_如何学Cr2[0]=Ptr1[1];
Is there any other way, because If the array is huge, copying will be a problem
I did the following
Ptr2=Ptr1;
This copies the address of Ptr1 to Ptr2 but its elements are not copied..
Please help
memcpy is your friend.
精彩评论