c 問題 兩個結果為何不同?

時間 2021-05-31 08:59:51

1樓:旺旺

If the value of the integer literal is too big to fit in any of the types allowed by suffix/base combination and the compiler supports extended integer types (such as __int128) the literal may be given the extended integer type -- otherwise the program is ill-formed.

2樓:

9223372036854775808的位表示是0x8000000000000000

對於signed long long 來說,9223372036854775808就是-9223372036854775808

請自行Google補碼規則

後面能顯示出來9223372036854775808,是因為它的型別是unsigned long long

3樓:hearts zh

1. Integer literal: 整數常量。

將根據以下列表依次看最小的能夠包容改整數的型別,既是該整數的型別。

intlong int

long long int

2. 如果沒有任何型別能夠包含該整數,程式本身就是錯誤的。

標準原話:A program is ill-formed if one of its translation units contains an integer literal that cannot be represented by any of the allowed types.

關於C語言的兩個問題,想問問大神執行結果為什麼會有ff?

char ch 修改為unsigned char ch 就ok了。對無符號數0xd2 210,大於127,賦值給char ch 有溢位,ch 得到0xd2實際數值是有符號數補碼表示0xd2 0xffd2 46。自動擴充套件到雙位元組了。寫入乙個小的值試試。 這個故事就很有趣了。先說結論,MinGW似...

幫忙解決C 看書遇到的兩個問題?

吳詠煒 書中這種寫法是為了表明這個拷貝構造非常簡單而已。從邏輯的角度,你還是可以理解成編譯器會幫你自動合成平凡的 trivial 拷貝建構函式。從這個角度理解,一是對的,編譯器會幫你自動合成A B的拷貝建構函式。二是錯的,A需要寫拷貝建構函式跟B要不要寫拷貝建構函式完全沒有關係。你就想象B是乙個系統...

0 C 0 C 273 C有問題嗎(不是兩個0度的物體加起來是273度的意思)?

Daniecy 問題出在第二個0 上 我們假定第乙個0 是現實中某個物體的溫度,並且有0 273K 32 但是第二個0 不是現實中某個物體的溫度 相反,在一般的語境下,這第二個0 表示的是0個溫度單位,也就是說,這裡第二個0 有如下關係 0 0K 0 它不表示某個具體的溫度,而表示的是比當前溫度高出...