Documente Academic
Documente Profesional
Documente Cultură
Q1. What is difference between call by Value and Call by Reference? Give an
example in c++ to illustrate both.
Q4. What do you mean by function prototyping? Write down the advantages of
function prototypes in C++?
Ans. Function prototyping means writing the function prototypes before their
function call occurs. A function prototype is a declaration of the function tells the
program about the type of the value returned by the function and the number and
type of arguments. The advantage of function prototyping is that it enables a
compiler to compare each use of function with the prototype to determine whether
the function is invoked properly or not. The number and types of arguments can be
easily compared and any wrong number of type of the argument is reported.
Therefore, function prototyping makes C++ straightaway point to the error.
If a function prototype is placed outside all the functions, it is global prototype and
the function is globally available to all the functions.