logo CodeStepByStep logo

array_mystery7

Language/Type: C arrays array mystery
Author: Allison Obourn (on 2020/09/14)

What element values are stored in array a after the following code runs?

int a[7] = {1, 7, 5, 6, 4, 14, 11};
for (int i = 0; i < 6; i++) {
    if (a[i] > a[i + 1]) {
        a[i + 1] = a[i + 1] * 2;
    }
}
elements

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.