fork download
  1. #include<stdio.h>
  2. struct student
  3. {
  4. int age;
  5. int year;
  6. };
  7. void func(struct student a);
  8. int main(void)
  9. {
  10. struct student data;
  11. data.age=18;
  12. data.year=2012;
  13. printf("年は%dで、年齢は%d\n",data.year,data.age);
  14. int *b;
  15. int *c;
  16. c=&(data.year);
  17. b=&(data.age);
  18. printf( "年齢のポインタ値:%p ポインタのポインタ値:%p\n", b,&b );
  19. printf( "年のポインタ値:%p ポインタのポインタ値:%p\n", c,&c );
  20. func(data);
  21. return 0;
  22. }
  23.  
  24. void func(struct student a)
  25. {
  26. a.age=20;
  27. a.year=2013;;
  28. printf("年はは%dで、年齢は%d\n",a.year,a.age);
  29. int *b;
  30. int *c;
  31. c=&(a.year);
  32. b=&(a.age);
  33. printf( "年齢のポインタ値:%p ポインタのポインタ値:%p\n", b,&b );
  34. printf( "年のポインタ値:%p ポインタのポインタ値:%p\n", c,&c );
  35. }
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
年は2012で、年齢は18
年齢のポインタ値:0xbfbc8b78 ポインタのポインタ値:0xbfbc8b70
年のポインタ値:0xbfbc8b7c ポインタのポインタ値:0xbfbc8b74
年はは2013で、年齢は20
年齢のポインタ値:0xbfbc8b60 ポインタのポインタ値:0xbfbc8b48
年のポインタ値:0xbfbc8b64 ポインタのポインタ値:0xbfbc8b4c