The Gateway to Computer Science Excellence
0 votes
43 views
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 by (29 points) | 43 views
+1
It'll print ASCII value of A = 65
+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'
0
thank you..

Please log in or register to answer this question.

No related questions found

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,391 answers
198,591 comments
105,442 users