編譯 : gcc hello.c -o hello
函數
運行 : ./hello.out
code
C99 標準中main函數返回必須爲int型,而不是void型。ci
bit: 0或者1.it
byte:8-bit,最大255.編譯
char:But it is integer type,Why?Because the char type actually stores integers. Use ASCII code for example the integer value 65 represents an uppercase A. The standard ASCII code runs numerically from 0 to 127, So char is 8-bit unit pf memory. 例如’A’,使用單引號。table
默認是有符號的,若是超過了就會變成無符號值,若是實在超過了就變成long或者longlong。gcc
Octal: 八進制,%o,%#o(能夠保留數值前面的0).gc
Hexadecimal:十六進制,%x,%#x(能夠保留數值前面的0x).im
如今我的電腦通常的設置是longlong是64bits,long是32bits,int是16bits或者32bits,short是16bits。主要看機器位數。
把小數值做爲大數值存儲:例如7L(此時7就是long型), 7LL(此時7就是long long型), 7LLU或者7ull(此時7就是unsigned long long型).call
signed int number: %d
unsigned int number: %u
signed long number: %ld
unsigned long number: %lu
signed short number: %hd
bits | signed | unsigned | number |
---|---|---|---|
8bits | -127~127 | 255 | 百位 |
16bits | -32767~32767 | 65535 | 萬位 |
32bits | –2,147,483,647 ~2,147,483,647 | 4,294,967,295 | 十億位 |
64bits | –9,223,372,036,854,775,807~9,223,372,036,854,775,807 | 18,446,744,073,709,551,615 | 好大 |