Page 1 of 1

R6.4 Consider the following array: int a[] = { 1, 2, 3, 4, 5, 4, 3, 2, 1, 0 }; What are the contents of the array a afte

Posted: Mon Jul 11, 2022 9:55 am
by answerhappygod
R6.4 Consider the following array: int a[] = { 1, 2, 3, 4, 5, 4,3, 2, 1, 0 }; What are the contents of the array a after thefollowing loops complete?
a. for (int i = 1; i < 10; i++) { a = a; }
b. for (int i = 9; i > 0; i--) { a = a; }
c. for (int i = 0; i < 9; i++) { a = a[i + 1]; }
d. for (int i = 8; i >= 0; i--) { a = a[i + 1]; }
e. for (int i = 1; i < 10; i++) { a = a + a;}
f. for (int i = 1; i < 10; i = i + 2) { a = 0; }
g. for (int i = 0; i < 5; i++) { a[i + 5] = a[i]; }
h. for (int i = 1; i < 5; i++) { a[i] = a[9 - i]; }