C++ supports ….

Options
- constant pointer
- pointer to a constant
- None of above
- Both of above


CORRECT ANSWER : Both of above

Discussion Board
C++ - Pointers

C++ supports constant pointer and pointer to a constant.

Constant Pointer :
A constant pointer is a pointer that cannot change the address its holding. In other words, we can say that once a constant pointer points to a variable then it cannot point to any other variable.
Syntax : * const ;
Example : int * const ptr;

Pointer to Constant :
A pointer through which one cannot change the value of variable it points is known as a pointer to constant. These type of pointers can change the address they point to but cannot change the value kept at those address.
Syntax : const *
Example : const int* ptr;

Prajakta Pandit 01-30-2017 01:24 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement