Skip to content

Instantly share code, notes, and snippets.

@msiemens
Created May 24, 2014 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msiemens/7469f96af3b5a2053fbc to your computer and use it in GitHub Desktop.
Save msiemens/7469f96af3b5a2053fbc to your computer and use it in GitHub Desktop.
Fundamental C Types
int main(void) {
char v_char;
unsigned char v_uchar;
short v_short;
unsigned short v_ushort;
int v_int;
unsigned int v_uint;
long v_long;
unsigned long v_ulong;
long long v_longlong;
unsigned long long v_ulonglong;
float v_float;
double v_double;
long double v_longdouble;
int* v_ptr_int;
float* v_ptr_float;
void* v_ptr_void;
printf("sizeof(char): %i\n", sizeof(v_char));
printf("sizeof(unsigned char): %i\n", sizeof(v_uchar));
printf("sizeof(short): %i\n", sizeof(v_short));
printf("sizeof(unsigned short): %i\n", sizeof(v_ushort));
printf("sizeof(int): %i\n", sizeof(v_int));
printf("sizeof(unsigned int): %i\n", sizeof(v_uint));
printf("sizeof(long): %i\n", sizeof(v_long));
printf("sizeof(unsigned long): %i\n", sizeof(v_ulong));
printf("sizeof(long long): %i\n", sizeof(v_longlong));
printf("sizeof(unsigned long long): %i\n", sizeof(v_ulonglong));
puts("\n");
printf("sizeof(float): %i\n", sizeof(v_float));
printf("sizeof(double): %i\n", sizeof(v_double));
printf("sizeof(long double): %i\n", sizeof(v_longdouble));
puts("\n");
printf("sizeof(int*): %i\n", sizeof(v_ptr_int));
printf("sizeof(float*): %i\n", sizeof(v_ptr_float));
printf("sizeof(void*): %i\n", sizeof(v_ptr_void));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment