Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 135

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 85

Answer:

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;

Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 135 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: