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

What is polymorphism give a real life example?

0 Answers  


What are classes oop?

0 Answers  


What is R T T I ?

6 Answers   Ness Technologies,


Define a class to represent a bank account. Include the following members: Data Members: Name of the Depositor Account Number Type of Account Balance amount in the account Member Functions: To assign the initial values. To deposit an account. To withdraw an amount after checking the balance. Write a C++ main program to display account number, name and balance.

6 Answers  


why reinterpret cast is considered dangerous?

0 Answers   TCS,






What is class and object in oops?

0 Answers  


Do you know about multiple inheritance?

0 Answers   Motorola,


when to use 'mutable' keyword and when to use 'const cast' in c++

0 Answers   TCS,


WHY FUCTION OVERLOADING DOSENOT RETURN A RETEN TYPE

2 Answers  


What is encapsulation c#?

0 Answers  


Pls...could any one tell me that whether we can access the public data memeber of a class from another class with in the same program. Awaiting for your response Thanku

4 Answers  


why to use template classes in c++?

1 Answers  


Categories