【C】Data size


每種機器上面的data type size不一定一樣,與其聽別人說,不如自己驗證。
#include <stdio.h>
#define BYTES 8
int main(void)
{
        printf("Get Data Type size...\n");
        printf("int    %d\n", sizeof(int) * BYTES);
        printf("float  %d\n", sizeof(float) * BYTES);
        printf("double %d\n", sizeof(double) * BYTES);
        printf("char   %d\n", sizeof(char) * BYTES);
        printf("unsigned long %d\n", sizeof(unsigned long) * BYTES);
#if 0
        printf("  %d\n", sizeof() * BYTES);
#endif
        printf("short %d\n", sizeof(short) * BYTES);
        printf("long  %d\n", sizeof(long) * BYTES);
        return 0;
}
 

Ed32. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com