Docsity

Programming with Functions - Lecture Slides | CSCI 261, Study notes of Computer Science

Partial preview of the text

Download Programming with Functions - Lecture Slides | CSCI 261 and more Study notes Computer Science in PDF only on Docsity!

Programming with Functions

PART II

July 29, 2009

Warm-Up! Question 1.

Program Heap and Stack

The Magic Behind the Compiler

Any sufficiently advanced technology is indistinguishable from magic. Arthur C. Clarke’s Third Law of Prediction

Simple A simple example of the stack in action. Automatic Variables How the compiler keeps all those variable and parameter names straight. Value and Reference Call by value and call by reference examples. Recursive Functions An extreme case of compiler voodoo with variable names. Predictable Garbage GARBAGE!=RANDOM, about 14 of Internet security holes are due to this fact.

Storage Class & Scope

Storage Class & Scope

Storage Class & Scope

Global Variables

Global Variables accessible by all the functions in a source file.

Storage Class & Scope

Global Variables

Global Variables accessible by all the functions in a source file.

Try question 2.

Practice, practice, practice...

finis