A function is a block of code that performs a specific task.
Functions help organize code, reduce repetition, and make programs easier to understand.
A function prototype tells the compiler about a function before it is used.
It defines the function name, return type, and parameters.
The function definition contains the actual code that runs.
You call a function by using its name followed by parentheses.
Parameters are variables defined in the function, while arguments are the values passed to it.
Functions can return values using the return statement.
The return type must match the function declaration.
If a function does not return a value, use void.
Arrays are passed to functions as pointers.
This means changes inside the function affect the original array.
C uses pass-by-value by default, meaning a copy is passed.
To modify the original value, use pointers.
Functions are essential for writing clean and reusable code.
Be careful with these:
Create a function that takes two integers and returns their sum.