Last active
February 13, 2023 19:54
-
-
Save nbassler/327194b8c7b9ea04588e8109c4b9e57d to your computer and use it in GitHub Desktop.
test platform dependent types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
int main(void) { | |
size_t *s; | |
double *d; | |
int *i; | |
char *c; | |
int z[2]; | |
char c2[2]; | |
printf("uint64_t : %i\n", (int) sizeof(uint64_t)); | |
printf("lli : %i\n", (int) sizeof(long long int)); | |
printf("li : %i\n", (int) sizeof(long int)); | |
printf("lu : %i\n", (int) sizeof(long unsigned int)); | |
printf("size_t* : %i\n", (int) sizeof(s)); | |
printf("size_t : %i\n", (int) sizeof(size_t)); | |
printf("ssize_t : %i\n", (int) sizeof(ssize_t)); | |
printf("long dble : %i\n", (int) sizeof(long double)); | |
printf("double* : %i\n", (int) sizeof(d)); | |
printf("double : %i\n", (int) sizeof(double)); | |
printf("int* : %i\n", (int) sizeof(i)); | |
printf("char* : %i\n", (int) sizeof(c)); | |
printf("int[2] : %i\n", (int) sizeof(z)); | |
printf("int : %i\n", (int) sizeof(int)); | |
printf("uint : %i\n", (int) sizeof(unsigned int)); | |
printf("short int : %i\n", (int) sizeof(short int)); | |
printf("short : %i\n", (int) sizeof(short int)); | |
printf("char[2] : %i\n", (int) sizeof(c2)); | |
printf("char : %i\n", (int) sizeof(char)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment