home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / pcmag / vol7n14.arc / FIG3.C < prev    next >
C/C++ Source or Header  |  1988-06-30  |  1KB  |  54 lines

  1. typedef struct _employees
  2. {
  3.     char empl_fname[15];
  4.     char empl_init[3];
  5.     char empl_lname[15];
  6.     unsigned empl_no;
  7.     char  empl_ssno[12];
  8. } EMPLOYEES;
  9.  
  10. typedef struct _clients
  11. {
  12.     char    client_name[30];
  13.     char    client_address[20];
  14.     char    client_city[15];
  15.     char    client_state[3];
  16.     char    client_zip[10];
  17.     long    client_no;
  18. } CLIENTS;
  19.  
  20. typedef struct _sales
  21. {
  22.     long    sales_no;
  23.     long    sales_date;
  24.     long    sales_invno;
  25.     long    sales_client_no;
  26.     unsigned    sales_emplno;
  27. } SALES;
  28.  
  29.  
  30. typedef union _records
  31. {
  32.     EMPLOYEES    employees;
  33.     CLIENTS      clients;
  34.     SALES        sales;
  35. } RECORDS;
  36.  
  37. #define MAXRECORDS 100
  38.  
  39. RECORDS records[MAXRECORDS];
  40.  
  41. main()
  42. {
  43.     printf("Data type:      Size (in bytes):\n");
  44.     printf("  Char           %d\n",sizeof(char));
  45.     printf("   Int           %d\n",sizeof(int));
  46.     printf("  Long           %d\n",sizeof(long));
  47.     printf("  Float          %d\n",sizeof(float));
  48.     printf(" Double          %d\n",sizeof(double));
  49.     printf("EMPLOYEES        %d\n",sizeof(EMPLOYEES));
  50.     printf(" CLIENTS         %d\n",sizeof(CLIENTS));
  51.     printf("  SALES          %d\n",sizeof(SALES));
  52.     printf(" RECORDS         %d\n",sizeof(RECORDS));
  53. }
  54.