【課題1−2

 

(プログラム例)

#include <stdio.h>

int main(void) {

         int i;

         short n;

         long m;

         float x;

         double y;

         char c;

 

         printf("i (int)    : %d bytes from %p\n", sizeof(int), &i);

         printf("n (short)  : %d bytes from %p\n", sizeof(short), &n);

         printf("m (long)   : %d bytes from %p\n", sizeof(long), &m);

         printf("x (float)  : %d bytes from %p\n", sizeof(float), &x);

         printf("y (double) : %d bytes from %p\n", sizeof(double), &y);

         printf("c (char)   : %d bytes from %p\n", sizeof(char), &c);

        

         return 0;

}

 

(実行例)

i (int)    : 4 bytes from 0xbffffa90

n (short)  : 2 bytes from 0xbffffa94

m (long)   : 4 bytes from 0xbffffa98

x (float)  : 4 bytes from 0xbffffa9c

y (double) : 8 bytes from 0xbffffaa0

c (char)   : 1 bytes from 0xbffffaa8