Chapter 14 - Functions and Program Structure (1)

Chapter 14 - Functions and Program Structure (1) -...

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

View Full Document Right Arrow Icon
Chapter 14 Functions “There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.” - C.A.R. Hoare
Background image of page 1

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

View Full DocumentRight Arrow Icon
BYU CS/ECEn Chapter 14 - C Functions 2 Topics to Cover… n Functions n C Functions n Function Examples n Function Notes n main Function n Activation Records n Run-time Stack n Function Calls
Background image of page 2
BYU CS/ECEn Chapter 14 - C Functions 3 Terms Call by Value - a copy of the argument is passed to the function. Frame - local data storage area allocated on the stack. Frame Pointer – Pointer to activation template Function Activation Record - a template of the relative positions of the function’s local variables within the frame. Function Argument – the value (expression) that is passed to the function in place of a parameter. Function Declaration - informs compiler about the function and its parameter types. Also called prototype. Function Definition – defines the function parameters and code. Function Parameter – a variable declared in the prototype or declaration of a function. Parameters have local scope.
Background image of page 3

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

View Full DocumentRight Arrow Icon
BYU CS/ECEn Chapter 14 - C Functions 4 Functions n Functions have been included in all programming languages since the very early days of computing. n Support for functions is provided directly in all instruction set architectures. n In other languages, called procedures, methods, subroutines, . .. n C is heavily oriented around functions. n A C program is organized as a collection of functions. n
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

Chapter 14 - Functions and Program Structure (1) -...

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

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