001、字符型和整型可以归纳为四大类。
char、 short int、 int、 long int。
char可以归为3类: char、signed char、unsigned char;
short int可以归为两类: signed short int、 unsigned short int;
int可以归为两类: signed int、 unsigned int;
long int可以归为两类: signed long int、 unsigned long int;
以上字符型和整型共计八种数据类型:
以上数据类型可以表示的范围储存在<limits.h> 头文件中。
#include <stdio.h> #include <limits.h> int main(void) { printf("char :%d~%d\n", CHAR_MIN, CHAR_MAX); printf("signed char :%d~%d\n", SCHAR_MIN, SCHAR_MAX); printf("unsigned char :%d~%d\n", 0, UCHAR_MAX); printf("short :%d~%d\n", SHRT_MIN, SHRT_MAX); printf("unsigned short:%u~%u\n", 0, USHRT_MAX); printf("int :%d~%d\n", INT_MIN, INT_MAX); printf("unsigned :%u~%u\n", 0, UINT_MAX); printf("long :%ld~%ld\n", LONG_MIN, LONG_MAX); printf("unsigned long :%lu~%lu\n", 0, ULONG_MAX); return 0; }