Computer Science, asked by aastha1612, 4 months ago

void main()
{
int array[10] = {3, 0, 8, 1, 12, 8, 9, 2, 13, 10);
int x, y, z;
x = ++array[2];
y = array[2]++;
z = array[x++];
printf("%d %d %d", x, y, z);
}
find the output​

Answers

Answered by VedaantArya
1

Answer:

10 9 10

Explanation:

5th line: array[2] = 8 previously, but it first gets incremented to 9, then assigned to x.

6th line: array[2] = 9 previously, it gets assigned first to y, then incremented later to 10.

7th line: x = 9 previously, use this to access array[9], which is 10. So z = 10. Now increment x, so x = 10.

You might've missed incrementing x in the 7th line, I made that mistake when thinking of the answer.

Similar questions