Select chapter



functions (3.papers)
loops (1.papers)
arrays (2.papers)
structures (3.papers)
unions (1.papers)
pointers (7.papers)
null pointers (1.papers)
strings (2.papers)
misc c concepts (1.papers)
Data structures (5.papers)
linked lists (3.papers)
trees (1.papers)
basics (5.papers)
Hide

Sponsored Links


  

c conditional statements interview questions and answers

1
Code for finding maximum of three numbers in c using ternary operator:

What is the output of below C program? What is this code doing?

#include  <stdio.h>

    
main(void)
{
    int i=-10, j=-8, k=-11;
    int h = (i>j)?(i>k? i:k):(j>k?j:k);
    printf("%d", h);
    return 0;
}
  1. -8, it is finding highest of 3 given numbers.
  2. -11, it is finding highest of 3 given numbers.
  3. -8, it is finding lowest of 3 given numbers.
  4. -11, it is finding highest of 3 given numbers.
Show Answer
Share Facebook gmail Twitter
Read more papers :