|
-
September 30th, 1999, 06:49 PM
#1
How to copy one array to the end of another array?
Urgent! Thank you very much.
-
October 1st, 1999, 04:15 AM
#2
Re: How to copy one array to the end of another array?
First you get the length of both Arrays: short int thing[] = {1,2,3,4};
int length = sizeof thing / sizeof (short);
And then if had both lengths add both to one: lenght += length2;
And then create a new Array: int *array = new int [length];
And then copy both arrays into the one and to not forget to delete the both arrays
for (int i =0; i<=length; i++)
{ array[i]=thing[i];} and delete thing.
-
October 1st, 1999, 05:50 AM
#3
Re: How to copy one array to the end of another array?
The best method could be to use memcpy
int i[10];
int j[10];
memcpy( &i[10], j, sizeof(int)*10 );
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|