home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / CHRSTRG.C < prev    next >
Text File  |  1989-11-10  |  531b  |  28 lines

  1.                                          /* Chapter 7 - Program 1 */
  2. #include "stdio.h"
  3.  
  4. void main()
  5. {
  6. char name[5];       /* define a string of characters */
  7.  
  8.    name[0] = 'D';
  9.    name[1] = 'a';
  10.    name[2] = 'v';
  11.    name[3] = 'e';
  12.    name[4] = 0;     /* Null character - end of text */
  13.  
  14.    printf("The name is %s\n",name);
  15.    printf("One letter is %c\n",name[2]);
  16.    printf("Part of the name is %s\n",&name[1]);
  17. }
  18.  
  19.  
  20.  
  21. /* Result of execution
  22.  
  23. The name is Dave
  24. One letter is v
  25. Part of the name is ave
  26.  
  27. */
  28.