ログイン
kid's world

変数とメモリの関係

/c/var-fig5.png

/c/var-table3.png

/c/var-table4.png

/c/var-table5.png

sizeof(int)
int size;
size = sizeof(int);
printf("%d\n",sizeof(int));
#include <stdio.h>

main()
{
  printf("int: %d\n",sizeof(int));
  printf("short: %d\n",sizeof(short));
  printf("long: %d\n",sizeof(long));
  printf("float: %d\n",sizeof(float));
  printf("double: %d\n",sizeof(double));
  printf("long double: %d\n",sizeof(long double));
}
#include <stdio.h>

main()
{
  int i;
  i=32767;
  printf("%d\n",i);
  i++;
  printf("%d\n",i);
}
32767
-32768

/c/var-fig6.png

/c/var-table6.png

#include <stdio.h>

main()
{
  int i;
  printf("%d\n",i);
}

広告


©Toshio Koide 1996-2007.

mail.gif

広告