0
私が実行するタスクを持っていると私は最初の部分を実行するために管理:アレイリフレクション基本タスク
// create an array B that has twice as many elements as A and is
// A forward followed by A in reverse
// if A is {3, 22, -5, 7} then we create B {3, 22, -5, 7, 7, -5, 22, 3}
// array A is declared and the size of A is 'size'
// myapproach
int B[2*size];
int i;
for (i = size; i >-1 ; i--) {
B[i] = A[i];
}
int j; int k;
for (j = 2*size; j>size; i--) {
k = size;
k++;
while (2*size < k) {
B[j] = B[k];
}
}
私のコードはタスク(B = {3、22、-5の最初の部分のために働きます、 7、})しかし、私は残りを把握できませんでした。手伝ってくれますか?
合計2つのループと、ネストされたループは必要ありません。また、最初のループは 'size'ではなく' size-1'からでなければなりません。 'A [size]'は範囲外です。 – twain249