C语言??确定char、short、int和short变量有符号和无符号时的取值范围

发布于:2021-07-30 20:57:44

C语言??确定char、short、int和short变量有符号和无符号时的取值范围

#include
#include

// determine ranges of types
int main()
{
// signed types
printf("signed char min = %d
", SCHAR_MIN);
printf("signed char max = %d
", SCHAR_MAX);
printf("signed short min = %d
", SHRT_MIN);
printf("signed short max = %d
", SHRT_MAX);
printf("signed int min = %d
", INT_MIN);
printf("signed int max = %d
", INT_MAX);
printf("signed long min = %ld
", LONG_MIN);
printf("signed long max = %ld
", LONG_MAX);
// unsigned types
printf("unsigned char max = %u
", UCHAR_MAX);
printf("unsigned short max = %u
", USHRT_MAX);
printf("unsigned int max = %u
", UINT_MAX);
printf("unsigned long max = %lu
", ULONG_MAX);
return 0;
}

相关推荐

最新更新

猜你喜欢