本文介紹了數字文字末尾的 F 和 D 是什么意思?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我見過一些這樣的符號,但我找不到任何奇怪的地方,
I've seen some of this symbols, but I cannot find anything strange with it,
double d = 5D;
float f = 3.0F;
5后面的D和F到底是什么意思?
What does the D and F behind 5 exactly means?
推薦答案
表示這些數字分別是雙精度數和浮點數.假設你有
Means that these numbers are doubles and floats, respectively. Assume you have
void foo(int x);
void foo(float x);
void foo(double x);
然后你打電話
foo(5)
編譯器可能會被難住.這就是為什么你可以說 5
、5f
或 5.0
來指定類型.
the compiler might be stumped. That's why you can say 5
, 5f
, or 5.0
to specify the type.
這篇關于數字文字末尾的 F 和 D 是什么意思?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!