# Fill Positions of one Array into another Array

• 05-06-2002
Unregistered
Fill Positions of one Array into another Array
Okay I have two arrays

face *A[21];
face *B[21];

i need to put positions 0-3-6-9-12-15-18 of A into 0 through 6 of B
1-4-7-10-13-14-19 of A into 7 through 13 of B and 2-5-8-11-14-21 of A into 14-20 of B.

I can't figure out how to do this, any help you can offer will be greatly appreciated.
• 05-06-2002
jdinger
Use a temp array to swap between. Swap all of array A into the temp, then copy the section of array B needed into array A. Finally copy the section from array A (stored in the temp array) into array B.
• 05-06-2002
Liam Battle
do your own homework assignment u dink...
if you ever used arrays before you would know how to do this without a problem.
• 05-06-2002
incognito
Quote:

Originally posted by Liam Battle
do your own homework assignment u dink...
if you ever used arrays before you would know how to do this without a problem.

Come on man, although you might be right, this is not the way to reply to this man, this is not contributing to the thread....plus it's not nice :D
• 05-06-2002
Sebastiani
Quote:

Come on man, although you might be right, this is not the way to reply to this man, this is not contributing to the thread....plus it's not nice
...gimme a break! the guy didn't even post any code...
• 05-06-2002
Xei
Calm
I dont think that any source code was needed for the type of description that he gave. Also, what is the purpose of a message board if people dont co-operate and respect eachother. Its to exchange knowlege and help eachother out. Beginners may struggle with some concepts, just as everyone does as they learn.
• 05-06-2002
Unregistered
i was just wondering if anyone had anyway to do it in a for loop instead of manually swapping all the values 1 by 1, thanks to most who replied..
• 05-06-2002
Unregistered
Maybe something like this??

Code:

```for(int x=0;x<22;x++) {   if(x%3==0)   {     B[x/3]=A[x];     B[x/3+7]=A[x+1];     B[x/3+14]=A[x+2];   } }```