O'Reilly logo

C Primer Plus, Fourth Edition by Stephen Prata

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required