fork download
  1. #include <stdio.h>
  2. int main(void)
  3. {
  4. int arr[5] = {10,20,30,40,50};
  5. int *p = arr; // 指针指向数组首元素
  6.  
  7. // 等价写法:
  8. printf("%d", *p); // arr[0]
  9. printf("%d", *(p+1)); // arr[1]
  10. printf("%d", p[2]); // p[2] = *(p+2)=arr[2]
  11.  
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
102030