types/sizeof-ints.c - Et program der 'udregner' bytestørrelsen af heltalstyperne. | Lektion 8 - slide 7 : 29 Program 2 |
/* Compute the sizes 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:%3u bytes\n", sizeof(int)); printf(" unsigned:%3u bytes\n", sizeof(unsigned)); printf(" long:%3u bytes\n", sizeof(long)); printf(" unsigned long:%3u bytes\n", sizeof(unsigned long)); printf(" short:%3u bytes\n", sizeof(short)); printf("unsigned short:%3u bytes\n", sizeof(unsigned short)); printf(" char:%3u byte \n", sizeof(char)); printf("\n"); return 0; }