Tilbage til slide -- Tastaturgenvej: 'u'  forrige -- Tastaturgenvej: 'p'  næste -- Tastaturgenvej: 'n'          sizeof-ints.c - Et program der 'udregner' bytestørrelsen af heltalstyperne.Lektion 5 - slide 6 : 24
Program 2

/* Compute the size of some fundamental types. */

#include <stdio.h>

int main(void)
{
   printf("\n");
   printf("Here are the sizes of some integral types:\n\n");

   printf("           int:%3d bytes\n", sizeof(int));
   printf("      unsigned:%3d bytes\n", sizeof(unsigned));
   printf("          long:%3d bytes\n", sizeof(long));
   printf(" unsigned long:%3d bytes\n", sizeof(unsigned long));
   printf("         short:%3d bytes\n", sizeof(short));
   printf("unsigned short:%3d bytes\n", sizeof(unsigned short));
   printf("          char:%3d byte \n", sizeof(char));

   printf("\n");
   return 0;
}