Review Questions

  1. Which storage classes create variables local to the function containing them?

  2. Which storage classes create variables that persist for the duration of the containing program?

  3. Which storage class creates variables that can be used across several files? Restricted to just one file?

  4. What might make the sorting algorithm inefficient?

  5. How would you change the sorting routine to make it sort in increasing order instead of decreasing order?

  6. How would you change getarray() to handle strings that represent octal numbers?

  7. Which functions know each variable in the following? Are there any errors?

     /* file 1 */ int daisy; int main(void) { int lily; ...; } int petal() { extern int daisy, lily; ...; } /* file 2 */ extern int daisy; static int lily; ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.