Introduction to C++
Functions With Arguments
A function with a parameter (argument) is a function that has to work with an object "from the outside".
A function argument is a local variable created and exists only in the current function.
For example, let's create a function that divides any integer by 2:
To use such a function, you need to call it and pass an argument to it:
Here is an example:
You can pass multiple arguments to a function:
func(5, 7) – calling a function and passing arguments to it.
Arguments are passed with commas (
You can also pass arrays: