c语言中输出整型和字符型9中数据类型在编译器中可以表示的数值范围。
1、
a、无符号整型的显示使用 %u
b、long型数据的显示使用 %l
c、无符号整型的最小值为0.
#include <stdio.h> #include <limits.h> int main(void) { printf("show the ranges. "); printf("char =%d-%d ", CHAR_MIN, CHAR_MAX); printf("signed char =%d-%d ", SCHAR_MIN, SCHAR_MAX); printf("unsigned char =%u-%u ", 0, UCHAR_MAX); printf("signed short int =%d-%d ", SHRT_MIN, SHRT_MAX); printf("signed int =%d-%d ", INT_MIN, INT_MAX); printf("signed lont int =%ld-%ld ", LONG_MIN, LONG_MAX); printf("unsigned short int =%u-%u ", 0, USHRT_MAX); printf("unsigned int =%u-%u ", 0, UINT_MAX); printf("unsigned long int =%lu-%lu ", 0, ULONG_MAX); return 0; }