为什么的sizeof(13.33)是8个字节? [英] why sizeof(13.33) is 8 bytes?
问题描述
当我给的sizeof(A)
,其中 A = 13.33
,浮点型变量,尺寸为4字节。
但是,如果我给的sizeof(13.33)
直接,大小为8字节。
When I give sizeof(a)
, where a=13.33
, a float variable, the size is 4 bytes.
But if i give sizeof(13.33)
directly, the size is 8 bytes.
我不明白发生了什么。有人可以帮忙吗?
I do not understand what is happening. Can someone help?
推荐答案
这些都是语言的规则。
13.33是数字文字。它被视为双,因为它是一个双。如果你想13.33被作为文字浮点处理,那么你的状态13.33f。
13.33 is a numeric literal. It is treated as a double because it is a double. If you want 13.33 to be treated as a float literal, then you state 13.33f.
13.33是一个双字面值。如果的sizeof(浮点)== 4的sizeof(13.33f)== 4还应持有,因为13.33f是一个浮动的文字。
13.33 is a double literal. If sizeof(float) == 4, sizeof(13.33f) == 4 should also hold because 13.33f is a float literal.
这篇关于为什么的sizeof(13.33)是8个字节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!