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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism what is it for and how is it used?

576


This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.

1640


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

1699


what are the different types of qualifier in java?

1842


What is an interface in oop?

595






Can destructor be overloaded?

599


What exactly is polymorphism?

610


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

1644


What is difference between pop and oop?

609


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

1395


c++ program to swap the objects of two different classes

1765


What are the types of abstraction?

557


What is difference between oop and pop?

618


hi all..i want to know oops concepts clearly can any1 explain??

1683


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

1652