C Data Type Sizes#

Done on systems current in 2015.#

MSOFT 32MSOFT 64MSOFT 64 CygwinLinux 32Linux 64Mac OS/X
char111111
short222222
int444444
long448488
long long888888
float444444
double888888
char*488488

Program Used#

#include <stdio.h>

#define PS(x)	printf("sizeof(" #x ") = %d\n", (int)sizeof(x))

int 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
#  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 page (revision-6) was last changed on 19-Apr-2017 16:43 by BlakeMcBride