Sams Teach Yourself C in 21 Days

(singke) #1
Answers for Day 15

Quiz


  1. The code is as follows:
    float x;
    float *px = &x;
    float **ppx = &px;

  2. The error is that the statement uses a single indirection operator and, as a result,
    assigns the value 100 topxinstead of to x. The statement should be written with a
    double indirection operator:
    **ppx = 100;
    3.arrayis an array with two elements. Each of these elements is itself an array that
    contains three elements. Each of these elements is an array that contains four type
    intvariables.
    4.array[0][0]is a pointer to the first four-element array of type int.

  3. The first and third comparisons are true; the second is not true.
    6.void func1(char *p[]);

  4. It has no way of knowing. This value must be passed to the function as another
    argument.

  5. A pointer to a function is a variable that holds the address where the function is
    stored in memory.
    9.char (ptr)(char x[]);

  6. If you omit the parentheses surrounding *ptr, the line is a prototype of a function
    that returns a pointer to type char.

  7. The structure must contain a pointer to the same type of structure.

  8. It means that the linked list is empty.

  9. Each element in the list contains a pointer that identifies the next element in the
    list. The first element in the list is identified by the head pointer.

  10. a.var1is a pointer to an integer.
    b.var2is an integer.
    c.var3is a pointer to a pointer to an integer.

  11. a.ais an array of 36 (3×12) integers.
    b.bis a pointer to an array of 12 integers.
    c.cis an array of 12 pointers to integers.


866 Appendix F

49 448201x-APP F 8/13/02 11:22 AM Page 866

Free download pdf