in Programming in C edited by
381 views
2 votes
2 votes
#include <stdio.h>

int main ()
{
    int i, j;
    int a [8] = {1, 2, 3, 4, 5, 6, 7, 8};
    for(i = 0; i < 3; i++) {
        a[i] = a[i] + 1;
        i++;
    }
    i--;
    for (j = 7; j > 4; j--) {
        int i = j/2;
        a[i] = a[i] - 1;
    }
    printf ("%d, %d", i, a[i]);
}
in Programming in C edited by
381 views

2 Comments

Why it should be 2 ?

Note that line no 12, has no effect on line 15

 

Trace line 6,7,8 step by step. Before entering into line no 10, i value is 4.
0
0
Thank you.
1
1

1 Answer

0 votes
0 votes
answer is 3, 2

Related questions