Call by Value vs Call by Reference:
- Call by Value: A copy of the variable is passed — changes do not affect the original.
- Call by Reference: Address of the variable is passed — changes affect the original variable (done using pointers).
- Recursion:
A function calling itself is called a recursive function.
Example:
int factorial(int n) {
if (n == 0) return 1;
else return n * factorial(n – 1);
}
Storage Classes (Brief Overview):
|
Storage Class |
Scope |
Lifetime |
Keyword |
|
auto |
Local |
Within block |
auto |
|
extern |
Global |
Whole program |
extern |
|
static |
Local |
Entire program |
static |
|
register |
Local |
Fast access |
register |