#include <stdio.h>
int main()
{
int k = 1;
printf("%d == 1 is" "%s\n ",k,k == 1? "TRUE": "FALSE");
return 0;
}
Solution :
1 == 1 is TRUE
Explanation :
printf("%d == 1 is" "%s\n",k,k == 1 ? "TRUE" : "FALSE");
The underlined statement can be expanded as:
if(k == 1)
{
"TRUE"
}
else
{
"FALSE"
}
Since k is initialised to 1,Hence
k = TRUE
The datatype assigned for k is integer and its value is 1
So %d in the printf statement will print 1
While the %s will print the string "TRUE"
No comments:
Post a Comment