home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch7 / la16.c < prev    next >
C/C++ Source or Header  |  2005-06-16  |  703b  |  31 lines

  1. /*              la16.c
  2.  *
  3.  *   Synopsis  - Displays the sizeof() a structure and
  4.  *               the values of two pointer arithmetic
  5.  *               expressions.
  6.  *   Objective - To provide practice with pointer 
  7.  *               arithmetic with pointers to structures.
  8.  */
  9.  
  10. /* Include Files */
  11. #include <stdio.h>
  12.  
  13. /* Constant Definitions */
  14. #define ID_SIZE 8
  15.  
  16. /* Type Descriptions */
  17. struct auto_part {
  18.      char id[ID_SIZE];
  19.      double price;
  20.      int cur_inv;
  21. } part;
  22.  
  23. int main( void )
  24. {
  25.      struct auto_part * partptr = ∂
  26.  
  27.      printf( "sizeof( part ) %d\n", sizeof( part ) );
  28.      printf( "partptr %d, partptr+1 %d\n", partptr, partptr+1);
  29.      return 0;
  30.