C Data Type Sizes#
Done on current systems in 2015.#
MSOFT 32 | MSOFT 64 | MSOFT 64 Cygwin | Linux 32 | Linux 64 | Mac OS/X | |
---|---|---|---|---|---|---|
char | 1 | 1 | 1 | 1 | 1 | 1 |
short | 2 | 2 | 2 | 2 | 2 | 2 |
int | 4 | 4 | 4 | 4 | 4 | 4 |
long | 4 | 4 | 8 | 4 | 8 | 8 |
long long | 8 | 8 | 8 | 8 | 8 | 8 |
float | 4 | 4 | 4 | 4 | 4 | 4 |
double | 8 | 8 | 8 | 8 | 8 | 8 |
char* | 4 | 8 | 8 | 4 | 8 | 8 |
Program Used#
#include <stdio.h> #define PS(x) printf("sizeof(" #x ") = %d\n", (int)sizeof(x)) main() { PS(char); PS(short); PS(int); PS(long); PS(long long); PS(float); PS(double); PS(char *); return 0; }
int to pointer code#
/* _M_X64 = predefined macro for 64 bit Microsoft C */ /* an int that is the same size as a pointer */ #ifndef INT_PTR #ifndef INT_PTR #ifdef _M_X64 typedef long long INT_PTR; #else typedef long INT_PTR; #endif #endif
Add new attachment
Only authorized users are allowed to upload new attachments.
«
This particular version was published on 14-Apr-2016 15:23 by BlakeMcBride.
JSPWiki v2.10.4