home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / POINTER.C < prev    next >
Text File  |  1989-11-10  |  612b  |  24 lines

  1.                                          /* Chapter 8 - Program 1 */
  2. #include "stdio.h"
  3.  
  4. void main()                        /* illustration of pointer use */
  5. {
  6. int index,*pt1,*pt2;
  7.  
  8.    index = 39;                             /* any numerical value */
  9.    pt1 = &index;                          /* the address of index */
  10.    pt2 = pt1;
  11.    printf("The value is %d %d %d\n",index,*pt1,*pt2);
  12.    *pt1 = 13;                  /* this changes the value of index */
  13.    printf("The value is %d %d %d\n",index,*pt1,*pt2);
  14. }
  15.  
  16.  
  17.  
  18. /* Result of execution
  19.  
  20. The value is 39 39 39
  21. The value is 13 13 13
  22.  
  23. */
  24.