0 votes 0 votes The output of statement printf ("%d", 10 ? 0 ? 5 : 11 : 12 ) ; eyeamgj asked Nov 22, 2017 eyeamgj 3.5k views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply just_bhavana commented Nov 22, 2017 reply Follow Share It will print 11, associatvity of ? : is right to left 1 votes 1 votes eyeamgj commented Nov 22, 2017 reply Follow Share @just_bhavna can u explain how u did using associativity ? 0 votes 0 votes just_bhavana commented Nov 22, 2017 reply Follow Share Refer the table here at the bottom http://www.geeksforgeeks.org/c-operator-precedence-associativity/ 0 votes 0 votes eyeamgj commented Nov 22, 2017 reply Follow Share @just_bhavna ......ya thats fine but can u provide steps of solutions. 0 votes 0 votes Please log in or register to add a comment.
Best answer 6 votes 6 votes Ans is 11 Explanation : If(10) if(0) // case failed printf(5) printf(11) inner if is false hence directly outer 11 is printed. Ashwin Kulkarni answered Nov 22, 2017 • selected Nov 22, 2017 by eyeamgj Ashwin Kulkarni comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments eyeamgj commented Nov 22, 2017 reply Follow Share thanks @ashwin and @srestha for the healthy conclusion oriented discussion nd solution. 0 votes 0 votes Hira Thakur commented Nov 22, 2017 reply Follow Share my doubt is IF(0) print 11 why??? because if case is false here due to 0 that's why it not print 5. it prints 11. This is a reason??? 0 votes 0 votes Ashwin Kulkarni commented Nov 22, 2017 reply Follow Share @Hira Thakur yes, if(0) is false thats why it will go to else case and it will print 11. 0 votes 0 votes Please log in or register to add a comment.