x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

A very big difference between pointers and references in nearly every situation is that a pointer is an indepedent variable and can be assigned NEW address values; whereas a reference, once assigned, can never refer to any new object until thevariable goes out of scope.

Answer

References are often confused with pointers but three major differences between references and pointers are:

  • You cannot have NULL references. You must always be able to assume that a reference is connected to a legitimate piece of storage.

  • Once a reference is initialized to an object, it cannot be changed to refer to another object. Pointers can be pointed to another object at any time.

  • A reference must be initialized when it is created. Pointers can be initialized at any time.

Answer

Reference Variables are constant address pointers, You can change the value of the variable from a function but will not be able to change the address of the reference variable. 

A pointers points to an address of a variable. Both it's value and the address it points to can be changed from a function. 

Answer

Hai Raj,

  • Very basically RV is a dublicate name to a value. And Pointer is the address of a value.
  • You cannot have NULL references. You must always be able to assume that a reference is connected to a legitimate piece of storage.

  • Once a reference is initialized to an object, it cannot be changed to refer to another object. Pointers can be pointed to another object at any time.

  • A reference must be initialized when it is created. Pointers can be initialized at any time.

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer