0 votes 0 votes 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]); } neha singh asked Mar 6, 2017 neha singh 1.6k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Array is x[] ={1,2,3,4,5,6,7,8}; First for loop changes array as x[x[i]]=x[i]; when i =2, x[x[2]]= x[3]= x[2] =3 //{1,2,3,3,5,6,7,8}; when i=3, x[x[3]]= x[3]= x[3] //no change when i=4, x[x[4]]= x[5]=x[4] =5 //{1,2,3,3,5,5,7,8}; when i=5, x[x[5]]= x[5]=x[5] //no change output will be 12335578 sh!va answered Mar 6, 2017 sh!va comment Share Follow See all 0 reply Please log in or register to add a comment.