c语言中sizeof()运算符显示各种数据类型的大小

c语言中显示各种数据类型的大小。

#include <stdio.h>

int main(void)
{
    //char type
    printf("char: %zd.

", sizeof(char));
    
    //integer type
    printf("short: %zd.
", sizeof(short));
    printf("int: %zd.
", sizeof(int));
    printf("long: %zd.
", sizeof(long));
    printf("long long: %zd.

", sizeof(long long));
    
    //float type
    printf("float: %zd.
", sizeof(float));
    printf("double: %zd.
", sizeof(double));
    printf("long double: %zd.
", sizeof(long double));
    
    
    return 0;
}

原文地址:https://www.cnblogs.com/liujiaxin2018/p/15037493.html