📜  s void 函数的结构 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:58.419000             🧑  作者: Mango

代码示例1
void FunctionName (Type1 FormalParameter1, Type2 FormalParameter2,
:
TypeN FormalParameterN)

NOTES:
1. A return statement is not used since a void fucntion does not return any value. 

Structure below is used to call the fucntion: 

FunctionName(ActualParameter1, ActualParameter2, ..., ActualParameterN );


- When the function is called, the value of ActualParameter1 is copied to FormalParameter1,
the value of ActualParameter2 to FormalParameter2, etc. 
- C++ is very precise about this. 
- The transfer of values between the actual and formal parameters always takes the order into account. 
- In other words, the first actual parameter always goes to the first formal parameter, and so on.
- As a result, there must always be the same number of actual parameters in the calling statement as the number of formal parameters in the function header, 
and their types must match, otherwise C++ will give an error message.