fork download
  1. #include <stdio.h>
  2.  
  3. void change( int *pp[], int n);
  4.  
  5. int main(void) {
  6. int a = 1;
  7. int b = 2;
  8.  
  9. int *p[2] = {&a, &b};
  10. int size = sizeof(p)/sizeof(p[0]);
  11. change(p, size);
  12.  
  13. printf("変数aの値:%d\n", a);
  14. printf("変数bの値:%d\n", b);
  15. return 0;
  16. }
  17. void change( int *pp[], int n){
  18. for(int i=0; i<n; i++){
  19. *pp[i] += 1;
  20. }
  21. }
  22.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
変数aの値:2
変数bの値:3