C int 关键字
实例
例子 1
打印一个整数:
int myNum = 1000;
printf("%d", myNum);
亲自试一试
例子 2
创建有符号、无符号、短整型和长整型整数:
int myInt = 4294967292;
unsigned int myUInt = 4294967292;
short int mySInt = 65532;
unsigned short int myUSInt = 65532;
long int myLInt = 18446744073709551612;
unsigned long int myULInt = 18446744073709551612;
printf("size: %zu bits value: %d\n", 8*sizeof(myInt), myInt);
printf("size: %zu bits value: %u\n", 8*sizeof(myUInt), myUInt);
printf("size: %zu bits value: %d\n", 8*sizeof(mySInt), mySInt);
printf("size: %zu bits value: %u\n", 8*sizeof(myUSInt), myUSInt);
printf("size: %zu bits value: %lld\n", 8*sizeof(myLInt), myLInt);
printf("size: %zu bits value: %llu\n", 8*sizeof(myULInt), myULInt);
亲自试一试
Read More