Utilizor
Contact Us

C++ Function Parameters

Passing data to functions.

C++ Function Parameters

Information can be passed to functions as a parameter. Parameters act as variables inside the function.

Parameters are specified after the function name, inside the parentheses. You can add as many parameters as you want, just separate them with a comma:

void functionName(parameter1, parameter2, parameter3) {
  // code to be executed
}

Default Parameter Value

You can also use a default parameter value, by using the equals sign (=).

If we call the function without an argument, it uses the default value ("Norway").