Write a C statement that declares a valid reference of int i-00210

Online Quiz This subjective question is related to the book/course vu cs101 Introduction to Computing. It can also be found in vu cs101 Mid Term Solved Past Paper No. 2.

Question 1: Write a C++ statement that declares a valid reference of int i; What is the benefit of reference and where can we use it?
Answer:
In the last lecture we were discussing about reference variables, we saw three examples; call by value, call by reference and call by pointer. We saw the use of stack when a function is called by value, by reference or by pointer. The arguments passed to the function and local variables are pushed on to the stack. There is one important point to note that in this course, we are using C/C++ but the usage of stack is similar in most of the computer languages like FORTRAN and Java . The syntax we are using here is C++ specific, like we are sending a parameter by pointer using & sign. In Java, the native data types like int, float are passed by value and the objects are passed by reference. In FORTRAN, every parameter is passed by reference. In PASCAL, you can pass a parameter by value or by reference like C++. You might have heard of ALGOL, this language had provided another way of passing parameter called call by name.

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background