Q. | What will be output when you will execute following c code? #include int main()
{
double num=5.2;
int var=5;
printf("%d\t",sizeof(!num));
printf("%d\t",sizeof(var=15/2));
printf("%d",var);
return 0;
}
Choose all that apply:
|
|||||||
|
Answer: | Option B | |
Explaination: |
sizeof(Expr) operator always returns the an integer value which represents the size of the final value of the expression expr. Consider on the following expression:
!num
=!5.2 =0 0 is int type integer constant and it size is 2 byte Any expression which is evaluated inside the sizeof operator its scope always will be within the sizeof operator. So value of variable var will remain 5 in the printf statement.
|
Discussion
Your Comments Goes here... |
Name | Discussion |
---|