edited by
9,801 views
5 votes
5 votes

What is the output of tho following program?

main(){
    int x=2, y=5;
    if(x<y) return (x=x+y);
            else printf("z1");
    printf("z2");
}
  1. $z2$
  2. $z1z2$
  3. Compilation error
  4. None of these
edited by

6 Answers

Best answer
8 votes
8 votes
This code will first replace value of variable x by (5+2)=7 because x<y.Then x will return it's current value 7.So no output will be printed.i.e option D is correct.
selected by
1 votes
1 votes

None of these. (D)
Runtime Error

Answer:

Related questions

5 votes
5 votes
2 answers
1
Arjun asked Apr 22, 2018
8,442 views
Consider the following program{ int x=1; printf("%d",(*char(char*)&x)); }Assuming required header files are included and if the machine in which this program is executed ...
1 votes
1 votes
2 answers
2
5 votes
5 votes
3 answers
3
Arjun asked Apr 22, 2018
5,574 views
Consider the following declaration :structaddr { char city[10]; char street[30]; int pin; }; struct { char name[30]; int gender; struct addr locate; } person, *kd = &pers...