Functions

Outline

Program structure
Pascal C/C++

Function
Example

Function
Things to remember

Call by value
Pascal C/C++

Call by value
Pascal C/C++

Call by value
Pascal C/C++

Call by value
Pascal C/C++

Call by value
Pascal C/C++

Call by reference

Call by reference:
Memory allocation process

Call by reference:
Memory allocation process

Using reference variables in functions

Using reference variables in functions

Call by reference
Pascal C/C++

Call by reference
Pascal C/C++

Call by reference
Pascal C/C++

Call by reference and arrays
Pascal C/C++

Call by arrrays
Pascal C/C++

Call by arrays
Pascal C/C++

Recursion

Recursion
An Example

Example 2. Coding in C/C++ from Pascal

Example: gcd

Example: lcm

Example: doIt

Example: doIt (Cont.)

Example: doIt (Cont.)

Example: main ()

WinMain()