What will be the output if you compile and execute the following c code ?
#include<stdio.h>
int main()
{
int a=5;
float b;
printf(“%d”,sizeof(++a+b));
printf(”%d”,a);
return 0;
float b;
printf(“%d”,sizeof(++a+b));
printf(”%d”,a);
return 0;
}
Comment your answer with explanation. Let's check your C Programming Knowledge.
Answer: 4 5
Explanation:
++5+x //++a+b
Sizeof operator will return 4 because size of float data type in c is 4 byte.
Value of any variable doesn’t modify inside sizeof operator. Hence value of variable a will remain 5.
Explanation:
++5+x //++a+b
Sizeof operator will return 4 because size of float data type in c is 4 byte.
Value of any variable doesn’t modify inside sizeof operator. Hence value of variable a will remain 5.
1 Comments
Answer: 4 5
ReplyDeleteExplanation:
++5+x //++a+b
Sizeof operator will return 4 because size of float data type in c is 4 byte.
Value of any variable doesn’t modify inside sizeof operator. Hence value of variable a will remain 5.