home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / EXAMPLES.ZIP / INTRO33.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  402 b   |  23 lines

  1. /* INTRO33.C--Example from Chapter 4 of Getting Started */
  2.  
  3. #include <stdio.h>
  4.  
  5. void swap(int *, int *);   /* This is swap's prototype */
  6.  
  7. int main()
  8. {
  9.    int x = 5, y = 7;
  10.    swap(&x, &y);
  11.    printf("x is now %d and y is now %d\n", x, y);
  12.  
  13.    return 0;
  14. }
  15.  
  16. void swap(int *a, int *b)    /* swap is actually defined here */
  17. {
  18.    int temp;
  19.    temp = *a;
  20.    *a = *b;
  21.    *b = temp;
  22. }
  23.