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 kind of linkage do block scope variables have?
5:What is the extern keyword use for?
6:Consider this code fragment:
int * p1 = (int *) malloc(100 * sizeof(int));

In terms of the final outcome, how does the following statement differ?

int * p1 = (int *) calloc(100, sizeof(int));
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, ...

Get C Primer Plus, Fourth 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.