Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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