float data type(5.0) being assigned 8 bytes rather that 4 using sizeof operator in C -


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

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -