Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不明白为什么这段代码会打印 24 和 20。
int main(){ int m = 24, n = 024; printf("%d %d", m, n); return 0; }
在 C 中,以“0”开头的数字是八进制。所以024表示 24 8,即 2•8 + 4 = 20。
024
前导 0 表示八进制,即以 8 为底。所以:
2 * 8 + 4 == 20