001.数据类型之int类型
#include <stdio.h> #include <limits.h> int main() { //有符号型整形 int a = 0; short int b = 1; long int c = 2; long long int d = 2; //无符号型整形 unsigned int unsigned_int = 123; size_t size_of_int = sizeof(int ); /** * 1.%d中的d表示decimal,有符号的10进制整形 * %ld表示long decimal * %lld表示long long decimal * %hd表示short decimal * 2.\n表示 new line * 3.%u表示无符号的10进制整形 * %hu表示unsigned short decimal * 4.x = hex 表示16进制 o = oct 表示8进制 */ printf("short int:%d\n", sizeof(short int)); printf("int:%d\n", sizeof(int)); printf("long int:%d\n", sizeof(long int)); printf("long long int:%d\n", sizeof(long long int)); printf("unsigned_int:%d\n", sizeof(unsigned)); printf("max:int %d min:%d\n", INT_MAX, INT_MIN); printf("max:int %u min:%d\n", UINT_MAX,0); return 0; }