Sams Teach Yourself C in 21 Days

(singke) #1
Manipulating Strings 513

17


Quiz ..............................................................................................................



  1. What is the length of a string, and how can the length be determined?

  2. Before copying a string, what must you be sure to do?

  3. What does the term concatenatemean?

  4. When comparing strings, what is meant by “One string is greater than another
    string”?

  5. What is the difference between strcmp()andstrncmp()?

  6. What is the difference between strcmp()andstrcmpi()?

  7. What values does isascii()test for?

  8. Using Table 17.4, which macros would return TRUEforvar?
    int var = 1;

  9. Using Table 17.4, which macros would return TRUEforx?
    char x = 65;

  10. What are the character-test functions used for?


Exercises ........................................................................................................



  1. What values do the test functions return?

  2. What would the atoi()function return if passed the following values?
    a.“65”
    b.“81.23”
    c.“-34.2”
    d.“ten”
    e.“+12hundred”
    f.“negative100”

  3. What would the atof()function return if passed the following?
    a.“65”
    b.“81.23”
    c.“-34.2”
    d.“ten”
    e.“+12hundred”
    f.“1e+3”


28 448201x-CH17 8/13/02 11:13 AM Page 513

Free download pdf