文章目录
资料收集
ascii码表
c语言取整与四舍五入
floor函数
向下取整。floor(x)返回的是x的整数部分。如: floor(2.5) = 2 floor(-2.5) = -3
ceil函数
向上取整。ceil(x)返回的是不大于x的最小整数。如: ceil(2.5) = 3 ceil(-2.5) = -2 floor和ceil对于正数没有区别,但是对于负数结果不同。floor()是向负无穷大舍入,floor(-2.5) = -3;ceil()是向正无穷大舍入,ceil(-2.5) = -2。
round(x) 返回x的四舍五入整数值。
printf格式符
length | d i | u o x X | f F e E g G a A | c | s | p | n |
---|---|---|---|---|---|---|---|
(none) | int | unsigned int | double | int | char* | void* | int* |
hh | signed char | unsigned char | signed char* | ||||
h | short int | unsigned short int | short int* | ||||
l | long int | unsigned long int | wint_t | wchar_t* | long int* | ||
ll | long long int | unsigned long long int | long long int* | ||||
j | intmax_t | uintmax_t | intmax_t* | ||||
z | size_t | size_t | size_t* | ||||
t | ptrdiff_t | ptrdiff_t | ptrdiff_t* | ||||
L | long double | ||||||
注:此表格说明了各种控制符及其长度符号的各种组合及适用对象,比如%ld用于long int符号,而 |
printf格式符释义
specifier | Output | Example |
---|---|---|
d or i | Signed decimal integer | 392 |
u | Unsigned decimal integer | 7235 |
o | Unsigned octal | 610 |
x | Unsigned hexadecimal integer | 7fa |
X | Unsigned hexadecimal integer (uppercase) | 7FA |
f | Decimal floating point, lowercase | 392.65 |
F | Decimal floating point, uppercase | 392.65 |
e | Scientific notation (mantissa/exponent), lowercase | 3.9265e+2 |
E | Scientific notation (mantissa/exponent), uppercase | 3.9265E+2 |
g | Use the shortest representation: %e or %f | 392.65 |
G | Use the shortest representation: %E or %F | 392.65 |
a | Hexadecimal floating point, lowercase | -0xc.90fep-2 |
A | Hexadecimal floating point, uppercase | -0XC.90FEP-2 |
c | Character | a |
s | String of characters | sample |
p | Pointer address | b8000000 |
n | Nothing printed. The corresponding argument must be a pointer to a signed int.The number of characters written so far is stored in the pointed location. | |
% A | % followed by another % character will write a single % to the stream. | % |
c语言各类型取值范围(32位cpu)
类型 | 范围 |
---|---|
char | -128~+127 |
unsigned char | 0~255 |
short | -32768~32768 |
unsigned short | 0~65535 |
int | -2147483648~2147483647 |
unsigned int | 0~4294967295 |
long | -2147483648~2147483647 |
unsigned long | 0~4294967295 |
long long | 的最小值:-9223372036854775808 |
long long | 的最大值:9223372036854775807 |
unsigned long long | 0~18446744073709551615 |
float | -2^128 ~ +2^128 精度为6~7位有效数字 |
double | -2^1024 ~ +2^1024 精度为15~16位有效数字 |
32/64位变量空间对比
类型 | 32位字节数 | 64位字节数 |
---|---|---|
bool | 1 | 1 |
char | 1 | 1 |
unsigned char | 1 | 1 |
short | 2 | 2 |
unsigned short | 2 | 2 |
int | 4 | 4 |
unsigned int | 4 | 4 |
long | 4 | 8 |
unsigned long | 4 | 8 |
Type *ptr | 4 | 8 |
工具类网站收集
综合
编程语言
linux
可视化vim配置文件生成
在线man手册
在线linux源码
内核镜像源
逐步从源码构建linux-lfs
linux内核手册
linux内核wiki
gnu官方在线手册
linux内核代码地图
所有gnu软件列表
前端
html参考手册
css参考手册
travis-ci yaml格式持续集成构建
codecov 集成测试覆盖率工具
simpleicons 图标素材
字节跳动图标库
阿里巴巴图标库
vercel 静态托管平台
网络协议
网络协议报文格式
协议报文字段含义查询
华为 IP知识百科
H3C ICT知识百科
工具类
杂项
编程语言排行
网站排名
ping及其他网络工具
正则练习
双拼练习
在线文本差异对比
数据结构
有趣的网站收集
花光比尔盖茨的钱
假装自己是黑客
360度全景图
网络搜索引擎
测试你的反应能力
I Wanna Be the Guy游戏