What is the difference between const int *ptr and int const
*ptr???

Answers were Sorted based on User's Feedback



What is the difference between const int *ptr and int const *ptr???..

Answer / manjunath

a) const int *ptr and
b) int const *ptr


Both actually mean the same...

Read from Right to left:
for(a):-> ptr is a pointer to an integer Constant and
for(b):-> ptr is a pointer to a constant integer...

..............
int *const ptr----------> ptr is a constant pointer to an
integer...

Is This Answer Correct ?    95 Yes 26 No

What is the difference between const int *ptr and int const *ptr???..

Answer / abdul sami

'const int* ptr' means the value whose address is being
held by ptr is constant and cant be changed while
'int const *ptr' means the pointer cant be changed like it
cant be incremented or decremented although you can change
the date pointed to by ptr.

Is This Answer Correct ?    41 Yes 57 No

Post New Answer

More OOPS Interview Questions

difference between structure and union.

2 Answers   ADP, Convergys,


what are three tenets of object orinted Systems?Why they call like that ? Please answer me. Advance thanks.

2 Answers   Excel,


What are properties in oop?

0 Answers  


which is best institute to learn c,c++ in ameerpet hyderabad

1 Answers  


Precompilation ?

1 Answers   emc2,






What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<<v(); } 1) 1 2) 0 3) Code cannot compile

4 Answers  


Have you ever used threads?

3 Answers   Adobe, IBM,


Why is abstraction used?

0 Answers  


what is the definition of incapsulation

2 Answers  


What is the difference between procedural programming and oops?

0 Answers  


What are functions in oop?

0 Answers  


Tell us about yourself.

47 Answers   ABB, Amazon, Fidelity, Flextronics, Franklin Templeton, HCL, Hexaware, IBM, Impetus, Infosys, Reliance, Rofous, Silgate, Sutherland, TCS, Thomson Reuters, Virtusa, Wipro,


Categories