0
unary operators : If float x; then x=sizeof(double) then why out is 0
5 Answers
+ 1
Because you use wrong format specifier. %d is used for `int` data. But you are actually printing `float` data. Use %f instead of %d, and it will work đ
+ 2
Thanks you for helping me đđđ
+ 1
No problem buddy đ
And for further introduction on format specifiers, you can check these out đ
http://www.cplusplus.com/reference/cstdio/scanf/
http://www.cplusplus.com/reference/cstdio/printf/
0
Why out is 0? I don't know. In your code you don't seem to be printing anything out. But assuming you did print the <x> value, how did you do it?
0
#include<stdio.h>
Main()
{
float x;
Clrscr();
X=sizeof (double);
Printf(''%d",x);
getch();
}
This is the program
Why output is 0 when float contain 4 byte and double contain 8 byte