Chapter 3-Lecture Notes-Part II

Chapter 3-Lecture Notes-Part II - hapter unctions Chapter F...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter            3     –   –            Functions     .   Part  Part            I   I   Storage classes: Ideas: 1. An identifier can be a variable name or a user-defined function name. 2. Each identifier has attributes: a. name b. type c. size d. value e. storage class f. scope g. linkage 3. There are two types of storage classes with their respective specifiers(keywords): a. Automatic i. auto ii. register: forces the compiler to maintain intensely used variables (like  counters, totals,…) in registers rather than in memory; this reduces the  overhead of swapping from memory to registers and vice versa. b. Static i. static ii. extern 4. An identifier’s storage class determines the period during which that identifier exists  in memory; whether during the entire execution of the program, or it is repeatedly  created and destroyed. 5. The identifier’s linkage determines in what source file   the identifier is known.  Linkage is studied in depth in more advanced chapters. 6. Automatic storage class: a. Idea:       the variables are created  when the block  in which they are declared and  used, is entered   . The variables are destroyed   when this block is exited   . b. only variables       can be of automatic storage class c. A function’s parameters and local variables are of automatic storage class. d. Note: a block can be a function or a compound statement inside a function. e. Local variables: i. are created when they are declared inside any function definition [and  main ()]. ii. are destroyed when the block where they are created is exited. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/27/2010 for the course DS csc 270 taught by Professor Dr.m.g during the Spring '10 term at Notre Dame University-Louaize.

Page1 / 4

Chapter 3-Lecture Notes-Part II - hapter unctions Chapter F...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online