不同类型变量的数据长度

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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值