fork download
  1. #include<stdio.h>
  2.  
  3. int main(void)
  4. { int x=123;
  5. int y=456;
  6. int sw;
  7.  
  8. printf("x=%d\n",x);
  9. printf("y=%d\n",y);
  10.  
  11. printf("変更するのは?[0...x/1...y]=");
  12. scanf("%d",&sw);
  13. printf("%d\n",sw);
  14.  
  15. int *p;
  16. if(sw==0) p=&x;
  17. else p=&y;
  18.  
  19. *p=999;
  20.  
  21. printf("x=%d\n",x);
  22. printf("y=%d\n",y);
  23. return 0;
  24. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
x=123
y=456
変更するのは?[0...x/1...y]=0
x=999
y=456