C Primer Plus 6th c语言笔记

经常使用知识:

  • 编译 : gcc hello.c -o hello函数

  • 运行 : ./hello.outcode

  • 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 好大
相关文章
相关标签/搜索