1.

What is the difference between references and pointers?(a) References are an alias for a variable whereas pointer stores the address of a variable(b) References and pointers are similar(c) References stores address of variables whereas pointer points to variables(d) Pointers are an alias for a variable whereas references stores the address of a variableThe question was asked by my school principal while I was bunking the class.My doubt stems from References topic in division Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Right choice is (a) References are an ALIAS for a variable whereas POINTER stores the address of a variable

The best I can explain: References are an alias/another NAME for a variable whereas pointer stores the address of a variable. POINTERS need to be deference before use whereas references need not.



Discussion

No Comment Found

Related InterviewSolutions