不同类型变量的数据长度

A short integer is at least 16 bits wide.
An int integer is at least as big as short.
A long integer is at least 32 bits wide and at least as big as int.

Many systems currently use the minimum guarantee, making short 16 bits and long 32 bits. This still leaves several choices open for int. It could be 16, 24, or 32 bits in width and meet the standard. Typically, int is 16 bits (the same as short) for older IBM PC implementations and 32 bits (the same as long) for Windows 98, Windows NT, Windows XP, Macintosh OS X, VAX, and many other minicomputer implementations.

# include "stdio.h"
int main()
{
	printf("The width of short is %d\n",sizeof(short));
	printf("The width of integer is %d\n",sizeof(int));
	printf("The width of long is %d\n",sizeof(long));
	printf("The width of char is %d\n",sizeof(char));
	getchar();
	return 0;
}

你可能感兴趣的:(C)