c语言中各个类型的sizeof长度

#include <stdio.h>
int main()
{
    printf( " \nA Char is %lu bytes "sizeofchar ));
    printf( " \nAn int is %lu bytes "sizeofint ));
    printf( " \nA short is %lu bytes "sizeofshort ));
    printf( " \nA long is %lu bytes "sizeoflong ));
    printf( " \nA long long is %lu bytes\n "sizeoflong  long ));
    printf( " \nAn unsigned Char is %lu bytes "sizeof( unsigned  char ));
    printf( " \nAn unsigned int is %lu bytes "sizeof( unsigned  int));
    printf( " \nAn unsigned short is %lu bytes "sizeof( unsigned  short ));
    printf( " \nAn unsigned long is %lu bytes "sizeof( unsigned  long ));
    printf( " \nAn unsigned long long is %lu bytes\n ", sizeof( unsigned  long  long ));
    printf( " \nfloat is %lu bytes "sizeoffloat ));
    printf( " \nA double is %lu bytes\n "sizeofdouble ));
    printf( " \nA long double is %lu bytes\n "sizeoflong  double ));
return  0;
}
muhuacat@muhuacat:~/bin# gcc -o c c.c 
muhuacat@muhuacat:~/bin# ./c

A Char  is  1 bytes
An  int  is  4 bytes
short  is  2 bytes
long  is  8 bytes
long  long  is  8 bytes

An unsigned Char  is  1 bytes
An unsigned  int  is  4 bytes
An unsigned  short  is  2 bytes
An unsigned  long  is  8 bytes
An unsigned  long  long  is  8 bytes

float  is  4 bytes
double  is  8 bytes

long  double  is  16 bytes

 

转载于:https://www.cnblogs.com/muhuacat/p/5482071.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值