Skip to content

Instantly share code, notes, and snippets.

@wtakuo
Created March 16, 2017 08:22
Show Gist options
  • Save wtakuo/921a735b31bf0f342cb7cc4864b1e8dd to your computer and use it in GitHub Desktop.
Save wtakuo/921a735b31bf0f342cb7cc4864b1e8dd to your computer and use it in GitHub Desktop.
Prints data sizes
#include <stdio.h>
#define print_size(t) printf("sizeof(%s) = %zu\n", #t, sizeof(t))
int main(void) {
print_size(char);
print_size(short);
print_size(int);
print_size(long);
print_size(long long);
print_size(char *);
print_size(void *);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment