home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / learn / employ1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-07  |  529 b   |  33 lines

  1. /* EMPLOY1.C: Demonstrate structure pointers. */
  2.  
  3. #include <stdio.h>
  4.  
  5.  
  6. struct employee
  7. {
  8.    char name[10];
  9.    int months;
  10.    float wage;
  11. };
  12.  
  13. void display( struct employee *e_ptr  );
  14.  
  15. main()
  16. {
  17.    static struct employee jones =
  18.       {
  19.       "Jones, J",
  20.       77,
  21.       13.68
  22.       };
  23.  
  24.    display( &jones );
  25. }
  26.  
  27. void display( struct employee *e_ptr )
  28. {
  29.    printf( "Name: %s\n", e_ptr->name );
  30.    printf( "Months of service: %d\n", e_ptr->months );
  31.    printf( "Hourly wage: %6.2f\n", e_ptr->wage );
  32. }
  33.