in Programming
413 views
0 votes
0 votes
What is the output? and how?

 

#include<stdio.h>
int main(){
    int var=75;
    int var2=56;
    int num;
    
    num=sizeof(var)?(var2>23?((var==75)?'A':0):0):0;
    printf("%d",num);
    return 0;
in Programming
413 views

3 Comments

It'll print ASCII value of A = 65
1
1
Ternary operator works here.

sizeof(var) is non zero , non -zero value is true .

var2>23?((var==75)?'A':0 ):0is executed.

var2>23 is true.

(var==75)?'A':0 is executed.

var==75 is true.

'A' is returned by the expression.

%d will print ASCII value of 'A'
1
1
thank you..
0
0

Please log in or register to answer this question.