0

hello,

i am having an array having 16 values
char index[16]={1,2,3,4,5,6,7,8,9,10,12,13,14,15,16}.

my question is i want to store the first,4th,8th and 12th value in arrar A (ie A[0]=1,A[2]=5,A[3]=9,A[4]=13).
the 2nd,6th,10th and 14th in array B.
the 3rd,7th,11th,15 in array C.
the 4th 8th, 12th 16th in array D


please help.


thanks alot.

3
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by simply_viks
0

Why do you need separate arrays? Just use the index array and a simple expression for figuring out the index.

0

Using a basic for or while loop, perhaps:

set i and j to zero
while(i is less than 12) {
  a[j]= index[i++]; 
  b[j] = index[i++];
  ... etc.
  j++;
}

Edited by Adak: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.