su**************@yahoo.com, India wrote:
On Sep 20, 8:44 am, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
>subramanian10...@yahoo.com wrote:
Kindly explain what is meant by behaviour of a function ? Does it mean
what task the function performs - say for example finding the square
root of a function Or does it mean how a function performs the task,
that is, the way of accomplishing a task
Kindly give the body of a function explaining what is meant by
behaviour of a function.
Read about "return values" and "side effects". If the function does
not have any of those, it has no behaviour.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May I request you to give example function bodies for these for me to
understand the behaviour.
[snip]
This is a function with a return value:
int four ( void ) {
return ( 4 );
}
This is a function with a side effect:
void make_four ( int & i ) {
i = 4;
}
This is a function with a side effect that you cannot tell from the
signature:
void log_error_4 ( void ) {
std::cerr << "Encountered Error 4. Don't ask what that means.\n";
}
Best
Kai-Uwe Bux