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

  1. /*                             manip.c
  2.  *
  3.  *   Synopsis  - Displays a string and its address. Changes the
  4.  *               string and displays it again.
  5.  *
  6.  *   Objective - To illustrate how an array can be used to store
  7.  *                and manipulate a string.
  8.  */
  9.  
  10. /* Include Files */
  11. #include <stdio.h>
  12.  
  13. int main( void )
  14. {
  15.                                                          /* Note 1 */
  16.      char work_string[ 512 ] = "One two, buckle my shoe\n";
  17.  
  18.                                                          /* Note 2 */
  19.      printf( work_string );
  20.      printf( "%s", work_string );
  21.      printf( "%p\n", work_string );
  22.      
  23.      *( work_string + 7 ) = '\n';                       /* Note 3 */
  24.      work_string[ 8 ] = '\0';                           /* Note 4 */
  25.  
  26.      printf( work_string );
  27.      return 0;
  28. }
  29.