Parameter Passing Flashcards
1
Q
Describes how values are passed to a function
A
Parameter Passing
2
Q
Types of Parameter Passing (2)
A
- Pass by Value
- Pass by Reference
3
Q
The formal parameter contains a copy of the value of the actual parameter.
Only the value is being passed.
A
Pass by Value
4
Q
The address of a variable is being passed to the function.
The formal parameter points to the actual parameter.
The matching formal parameter is a pointer.
A
Pass by Reference
5
Q
When to use pass by value?
A
- When you are NOT changing the actual parameter
- When you are returning ONLY ONE value
6
Q
When to use Pass by Reference?
A
- When you need to change the value of the actual parameter
- When you need to modify two or more values