Tuesday 26 March 2013

j = i, j?(i,j)?i:j:j;


    main()
{
         int i=10,j=20;
    j = i, j?(i,j)?i:j:j;
         printf("%d %d",i,j);
}

Answer:
10 10
Explanation:
         The Ternary operator ( ? : ) is equivalent for if-then-else statement. So the question can be written as:
         if(i,j)
            {
if(i,j)
              j = i;
         else
             j = j;           
         }
       else
         j = j;      

Blog Author: Vijay Kumar

1 comment:

  1. what is if(i,j) means in your explanation...is that if(i == j)

    ReplyDelete