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

#include <stdio.h>

int main()

{

    printf("\nA Char is %lu bytes", sizeof( char ));

    printf("\nAn int is %lu bytes", sizeof( int ));

    printf("\nA short is %lu bytes", sizeof( short ));

    printf("\nA long is %lu bytes", sizeof( long ));

    printf("\nA long long is %lu bytes\n", sizeof( long 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", sizeof( float ));

    printf("\nA double is %lu bytes\n", sizeof( double ));

    printf("\nA long double is %lu bytes\n", sizeof( long double ));

return ;

}
muhuacat@muhuacat:~/bin# gcc -o c c.c 
muhuacat@muhuacat:~/bin# ./c A Char is  bytes
An int is  bytes
A short is  bytes
A long is  bytes
A long long is  bytes An unsigned Char is  bytes
An unsigned int is  bytes
An unsigned short is  bytes
An unsigned long is  bytes
An unsigned long long is  bytes float is  bytes
A double is  bytes A long double is  bytes
上一篇:5.2 spring5源码--spring AOP源码分析三---切面源码分析


下一篇:矩阵乘法 --- hdu 4920 : Matrix multiplication