home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / list5_2.c < prev    next >
C/C++ Source or Header  |  1993-10-16  |  622b  |  27 lines

  1.    /* Illustrates the difference between arguments and parameters. */
  2.  
  3.    #include <stdio.h>
  4.  
  5.    float x = 3.5, y = 65.11, z;
  6.  
  7.    float half_of(float k);
  8.  
  9.    main()
  10.   {
  11.       /* In this call, x is the argument to half_of(). */
  12.       z = half_of(x);
  13.       printf("The value of z = %f\n", z);
  14.  
  15.       /* In this call, y is the argument to half_of(). */
  16.       z = half_of(y);
  17.       printf("The value of z = %f\n", z);
  18.   }
  19.  
  20.   float half_of(float k)
  21.   {
  22.       /* k is the parameter. Each time half_of() is called, */
  23.       /* k has the value that was passed as an argument. */
  24.  
  25.       return (k/2);
  26.   }
  27.