float data type(5.0) being assigned 8 bytes rather that 4 using sizeof operator in C -
this question has answer here:
why sizeof(5.0) return 8 output rather 4 machine allocates 4 bytes float data type? default consider 5.0 double (memory allocated = 8 bytes), if yes why so?
because floating point literals default double. if want float use f suffix in 5.0f.
read e.g. this floating point constant (literal) reference more information.
Comments
Post a Comment