fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a = 1;
  5. int b = 2;
  6.  
  7. int *p[2];
  8.  
  9. p[0] = &a;
  10. p[1] = &b;
  11.  
  12. printf("変数a:%p , %d \n", &a, a );
  13. printf("変数b:%p , %d \n", &b, b );
  14.  
  15. for(int i=0; i<2; i++){
  16. printf("ポインタの配列p[%d]:%p ,%d \n", i, p[i], *p[i] );
  17. }
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
変数a:0x7ffd60ca8f50 , 1 
変数b:0x7ffd60ca8f54 , 2 
ポインタの配列p[0]:0x7ffd60ca8f50 ,1 
ポインタの配列p[1]:0x7ffd60ca8f54 ,2