Skip to content

Instantly share code, notes, and snippets.

@joehakimrahme
Created June 4, 2012 13:13
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 joehakimrahme/2868290 to your computer and use it in GitHub Desktop.
Save joehakimrahme/2868290 to your computer and use it in GitHub Desktop.
K&R (2.1): Size of types
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv)
{
signed short i, min, max;
i = min = max = 0;
while (++i) {
if (i > max)
max = i;
if (i < min)
min = i;
}
printf ("min: %d\n", min);
printf ("Max: %d\n", max);
printf ("Size: %d byte(s)\n", sizeof(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment