The output of the following program is main() { static int x[] =…

ISRO Scientist/Engineer SC 2015

The output of the following program is

main()
{
static int x[] = {1,2,3,4,5,6,7,8};
int i;
for (i=2; i<6; ++i)
x[x[i]]=x[i];
for (i=0; i<8; ++i)
printf("%d", x[i]);
} 

  1. A.

    1 2 3 3 5 5 7 8

  2. B.

    1 2 3 4 5 6 7 8

  3. C.

    8 7 6 5 4 3 2 1

  4. D.

    1 2 3 5 4 6 7 8

Attempted by 631 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…