0 votes
in C Plus Plus by

When to use “const” reference arguments in a function?

1 Answer

0 votes
by
Using “const” reference arguments in a function is beneficial in several ways:

“const” protects from programming errors that could alter data.

As a result of using “const”, the function is able to process both const and non-const actual arguments, which is not possible when “const” is not used.

Using a const reference will allow the function to generate and use a temporary variable in an appropriate manner.

Structure & User-Defined Data Types

Related questions

0 votes
asked Feb 16 in Taleo by Robin
+1 vote
asked Jun 24, 2021 in Redux by SakshiSharma
...