Sams Teach Yourself C in 21 Days

(singke) #1

  1. Continuing with exercise 4, show two ways of using pointer notation to assign the
    value5.5to the first floatmember of info.

  2. Write the definition for a structure type named datathat can hold a single string of
    up to 20 characters.

  3. Create a structure containing five strings:address1,address2,city,state, and
    zip. Create a typedefcalledRECORDthat can be used to create instances of this
    structure.

  4. Using the typedeffrom exercise 7, allocate and initialize an element called myad-
    dress.
    9.BUG BUSTER:What is wrong with the following code?
    struct {
    char zodiac_sign[21];
    int month;
    } sign = “Leo”, 8;
    10.BUG BUSTER:What is wrong with the following code?
    / setting up a union /
    union data{
    char a_word[4];
    long a_number;
    }generic_variable = { “WOW”, 1000 };


284 Day 11

18 448201x-CH11 8/13/02 11:17 AM Page 284

Free download pdf