1. 程式人生 > >計算各種型別資料所佔用的位元組數

計算各種型別資料所佔用的位元組數

//計算各種型別資料佔用的位元組數
#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;
}