A function is a reusable block of code that performs a specific task.
Functions help organize code and reduce repetition.
A function declaration tells the compiler about the function before it is used.
The function definition contains the actual implementation.
You call a function by using its name followed by parentheses.
Functions can take inputs (parameters) and return outputs.
Function overloading allows multiple functions with the same name but different parameter types.
The compiler determines which function to call based on the arguments.
The correct function is automatically selected based on input types.
By default, C++ passes arguments by value (a copy is made).
Using references allows a function to modify the original variable.
C++ allows default values for function parameters.
Functions are essential for writing clean and reusable code.
Be careful with these:
Create two overloaded functions that add integers and doubles.