adsense


Monday, 23 November 2015

C++ LANGUAGE FUNCTION ARGUMENTS PAGE 71

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



C++ LANGUAGE FUNCTION ARGUMENTS







Function Arguments 


If a function is to use arguments, it must declare variables 
that accept the values of the arguments. These variables are 
called the formal parameters of the function. 
The formal parameters behave like other local variables inside 
the function and are created upon entry into the function and 
destroyed upon exit. 

While calling a function, there are two ways that arguments 
can be passed to a function: 



Call Type          Description 
Call by value        This method copies the actual value of an 
                      argument into the formal parameter of the function. 
                      In this case, changes made to the parameter 
                      inside the function have no effect on the argument. 
Call by pointer       This method copies the address of an argument into 
                      the formal parameter. Inside the function, the address is 
                      used to access the actual argument used in the call. 
                      This means that changes made to the parameter 
                      affect the argument. 
Call by reference     This method copies the reference of an argument 
                      into the formal parameter. Inside the function, the 
                      reference is used to access the actual argument used 
                      in the call. This means that changes made to 
                      the parameter affect the argument. 




No comments: