O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.13. Function Parameter Semantics

The parameters of a function serve as placeholders within the function body. With each invocation, the parameters are bound to the actual arguments passed to the function. By default, this binding is carried out by value. We can override the default by modifying the parameter with either the ref or the out keyword. These kinds of parameters are bound by reference.

Each parameter minimally consists of a type specifier, such as int, string, or Matrix, and a name. The parameter name is visible only within the function, so the name can be reused outside the function without conflict. A comma separates multiple parameters. We write

f( int i, int j ){ ... }

not

// error!
f( int i, j ){ ... }

An empty parameter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required