04.Basics of C++ functions
04.Basics of C++ functions
This means that we can use the same function name to creates functions
that perform a variety of different tasks.
main( ) {
cout<<volume(10)<<endl;
cout<<volume(10,10.5)<<endl;
output:- 1000
3297
Functions can be called by two ways:
1) call by value
2) call by reference
Call By Value
● In this parameter passing method, values of actual parameters are
copied to function’s local parameters and the two types of parameters
are stored in different memory locations.
x
x== 20
10 y
y== 10
20
● still in the main() method those changes are not passed on.
x = 1002 y = 1004
2002 2004