C语言整数
整数的修饰符:
signed与unsigned 有符号与无符号
short与long 短的与长的
整数的范围
常用的库函数
int atoi(const char *nptr); // 把字符串nptr转换为int整数
long atol(const char *nptr); // 把字符串nptr转换为long整数
int abs(const int j); // 求int整数的绝对值
long labs(const long int j); // 求long整数的绝对值
课后作业:
1.
short:2 unsigned short:2
int:4 unsigned int:4
long:8 unsigned long:8
int范围 -2147483648~2147483647 -231~231-1
long范围 -9223372036854775808~9223372036854775807
用atoi将字符串数字变成int数字
重写ABS LABS 求绝对值
用ctoi将字符数字转化为int数字