pnt_add.c 469 B

1234567891011121314151617181920
  1. // pnt_add.c -- pointer addition
  2. #include <stdio.h>
  3. #define SIZE 4
  4. int main(void)
  5. {
  6. short dates [SIZE];
  7. short * pti;
  8. short index;
  9. double bills[SIZE];
  10. double * ptf;
  11. pti = dates; // assign address of array to pointer
  12. ptf = bills;
  13. printf("%23s %15s\n", "short", "double");
  14. for (index = 0; index < SIZE; index ++)
  15. printf("pointers + %d: %10p %10p\n",
  16. index, pti + index, ptf + index);
  17. return 0;
  18. }