Answers for "Structure of s void function"


Structure of s void function

void FunctionName (Type1 FormalParameter1, Type2 FormalParameter2,
TypeN FormalParameterN)

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.
Posted by: Guest on October-08-2021

Browse Popular Code Answers by Language