C Programming :: Declarations and Initializations - Discussion
30 / 54
#include<stdio.h>
void main ( )
{
int a=500, b=100,c;
if( !(a>=400))
b=200;
c=200;
printf( "%d %d", b,c);
}
#include<stdio.h>
void main ( )
{
int a=500, b=100,c;
if( !(a>=400))
b=200;
c=200;
printf( "%d %d", b,c);
}
A200 100
B100 200
C200 200
DCompilation Error
Show Explanation
In the next line, we have an if condition, let's try to analyze it-
a>=400, which is true as 500>400, so the result is 1, but !1 results to 0. So, the 'if' part now becomes something like if(0), which is false. So, the 'if' part is not executed, which means b is not updated to 200. b remains 100 as it was.
c gets initialzed to 200.
So, the output will be 100 200.
Asked In ::
In line no 4, a and b are initialized with values 500 and 100 respectively.
In the next line, we have an if condition, let's try to analyze it-
a>=400, which is true as 500>400, so the result is 1, but !1 results to 0. So, the 'if' part now becomes something like if(0), which is false. So, the 'if' part is not executed, which means b is not updated to 200. b remains 100 as it was.
c gets initialzed to 200.
So, the output will be 100 200.
Read Full Answer
Report Error
Please Login First Click Here