fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a[3] = {1,2,3};
  5.  
  6. int *p = a;
  7.  
  8. for(int i=0; i<3; i++){
  9. printf("a[%d]:%d \n", i, a[i]);
  10. printf("p[%d]:%d \n", i, p[i]);
  11. }
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
a[0]:1 
p[0]:1 
a[1]:2 
p[1]:2 
a[2]:3 
p[2]:3