Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created December 21, 2011 17:06
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 bnoordhuis/1506791 to your computer and use it in GitHub Desktop.
Save bnoordhuis/1506791 to your computer and use it in GitHub Desktop.
/*
* Copyright (c) 2011, Ben Noordhuis <info@bnoordhuis.nl>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdio.h>
#define P(type) printf("%-2zu sizeof(" #type ")\n", sizeof(type))
int main(void)
{
P(void (*)(void));
P(void *);
P(char);
P(short);
P(int);
P(long);
P(long long);
P(unsigned char);
P(unsigned short);
P(unsigned int);
P(unsigned long);
P(unsigned long long);
P(float);
P(double);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment