Get Started. It's Free
or sign up with your email address
Rocket clouds
FUNCTION by Mind Map: FUNCTION

1. Definition

1.1. A block of instructions that carry out particular task

2. Types of functions

2.1. 1) Built-in functions

2.1.1. Functions that already built by C++ compiler designer

2.1.2. Predefined by producer of a compiler (C++) and stored in header file (.h files) called libraries

2.1.3. Example : iomanip.h , math.h

2.2. 2) User-defined functions

2.2.1. Function designed, written or defined by programmers

2.2.2. Must be called in order to execute the statements contained in its definition

2.2.3. 3 requirements

2.2.3.1. Function prototype

2.2.3.1.1. Placed after header file and before main ( ) function

2.2.3.2. Function call

2.2.3.2.1. Placed within body of main ( ) function

2.2.3.3. Function definiton

2.2.3.3.1. Description or definition of what each function does

2.2.4. 2 categories

2.2.4.1. Value-returning function

2.2.4.2. Void function

2.2.5. Types of UDF

2.2.5.1. No parameter and no return value

2.2.5.2. No parameter but return value

2.2.5.3. Parameter but no return value

2.2.5.4. Parameter and return value

2.2.5.5. Parameter and return more than one value

3. Local & Global Variable

3.1. Local Variable

3.1.1. Declared within a function and accessible only within that function

3.2. Global Variable

3.2.1. Declared before main function and accessible by all modules in the program

4. Parameter List

4.1. Pass information between main program and function

4.2. 2 types

4.2.1. Formal Parameter

4.2.1.1. A variable declared in the function heading

4.2.2. Actual Parameter

4.2.2.1. A variable or expression listed in a call to a function

5. Parameter Passing

5.1. Passing Value

5.1.1. declaration : int x;

5.1.2. cannot change actual parameter

5.1.3. constant, variable expression

5.1.4. duplicate actual parameter

5.1.5. read-only

5.1.6. local variable

5.2. Passing Reference

5.2.1. declaration : int &x;

5.2.2. can change actual parameter

5.2.3. variable

5.2.4. synonym for the actual parameter

5.2.5. read-write

5.2.6. local reference