计算各种类型数据所占用的字节数

时间:2022-12-16 22:46:46
//计算各种类型数据占用的字节数
#include <stdio.h>
int main()
{
    printf("Size of int is: %d\n",sizeof(int));
    printf("Size of short int is: %d\n",sizeof(short));
    printf("Size of long int is: %d\n",sizeof(long));
    printf("Size of unsigned int is: %d\n",sizeof(unsigned int));
    printf("Size of float is: %d\n",sizeof(float));
    printf("Size of double is: %d\n",sizeof(double));
    printf("Size of long double is: %d\n",sizeof(long double));
    printf("Size of char is: %d\n",sizeof(char));
    return 0;
}