C Data Type Sizes#

MSOFT 32MSOFT 64MSOFT 64 CygwinLinux 32Linux 64Max OS/X<br>Intel/M1
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#

/* an int that is the same size as a pointer */

#include <stdint.h>

intptr_t  myInt;
void *ptr = (void *) 123;

myInt = (intptr_t) ptr;

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-6) was last changed on 05-Nov-2023 16:26 by BlakeMcBride