What are the ways to transfer parameters in C++?
This article shows you what ways to pass parameters in C++, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Value transfer
As we all know, the parameter in the parenthesis of the function definition is a formal parameter, which is a special local variable within the function, which means that the function receives a copy of the actual parameter. If the value of the parameter is changed inside the function, it has no effect on the actual parameter.
# include using namespace std;void change (int formalNum) {formalNum = 0; cout