Question:What will be output when you will execute following c code?#include<stdio.h>
void main(){
if("ABC") printf("Barack Obama\n");
if(-1) printf("Hu Jintao\n");
if(.92L) printf("Nicolas Sarkozy\n");
if(0) printf("Ben Bernanke\n");
if('W') printf("Vladimir Putin\n");
}
Choose all that apply:
A It will print nothing
B Barack Obama
Hu Jintao
Nicolas Sarkozy
Vladimir Putin
C Barack Obama
Hu Jintao
Nicolas Sarkozy
Ben Bernanke
Vladimir Putin
D Hu Jintao
Nicolas Sarkozy
Vladimir Putin
E Compilation error
+ Explanation“ABC”: It is string constant and it will always return a non-zero memory address.
0.92L: It is long double constant.
‘W’: It is character constant and its ASCII value is
As we know in c language zero represents false and any non-zero number represents true. In this program condition of first, second, third and fifth if statements are true.