home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / alb_c10 / chap_09 / ch09_02.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-08  |  858 b   |  41 lines

  1. /*********************************************************************
  2. *  CH09_02.C                                             Tableau  *
  3. *                    Initialisation et accΦs aux ΘlΘments *
  4. *********************************************************************/
  5.  
  6. #include<stdio.h>
  7.  
  8. main( void)
  9. {
  10.     int i, tab[]= { 0, 1, 2, 3, 4}, *ptr= tab;
  11.  
  12.     for( i= 0; i< 5; i++)
  13.         {
  14.       printf("\n tab[%d]= %d \t *( ptr+ %d)= %d",
  15.                 i, tab[i], i, *( ptr+ i) );
  16.     }
  17.  
  18.       /* modification du 4Φme ΘlΘment                    */
  19.     tab[3]= 5;
  20.     printf("\n\n tab[3]= %d", tab[3]);
  21.  
  22.         *( ptr+ 3)= 10;
  23.     printf("\n tab[3]= %d", tab[3]);
  24. }
  25.  
  26. /*
  27.  
  28.  tab[0]= 0    *( ptr+ 0)= 0
  29.  tab[1]= 1    *( ptr+ 1)= 1
  30.  tab[2]= 2    *( ptr+ 2)= 2
  31.  tab[3]= 3    *( ptr+ 3)= 3
  32.  tab[4]= 4    *( ptr+ 4)= 4
  33.  
  34.  tab[3]= 5
  35.  tab[3]= 10                                                        */
  36.  
  37.  
  38.  
  39.  
  40.  
  41.