001、
c语言中将表示字符的char型的长度定义为1.
#include <stdio.h> #include <limits.h> int main(void) { printf("sizeof(char) = %u\n", (unsigned)sizeof(char)); printf("sizeof(short) = %u\n", (unsigned)sizeof(short)); printf("sizeof(int) = %u\n", (unsigned)sizeof(int)); printf("sizeof(long) = %u\n", (unsigned)sizeof(long)); printf("unsigned char: %d-%d\n", 0, UCHAR_MAX); printf("unsigned short: %u-%u\n", 0, USHRT_MAX); printf("unsigned int: %u-%u\n", 0, UINT_MAX); printf("unsigned long: %lu-%lu\n", 0, ULONG_MAX); return 0; }
标签:-%,字节,int,unsigned,C语言,char,printf,sizeof,变量 From: https://www.cnblogs.com/liujiaxin2018/p/16586896.html