What is constant keyword in C++? Illustrate its various uses.



What is constant keyword in C++? Illustrate its various uses...

Answer / Rajesh Kumar Gupta

The const keyword in C++ can be used to declare a variable, function, or pointer as read-only. Const variables must be initialized at the point of declaration and cannot be modified thereafter. Const functions cannot modify any non-const object or variable within their scope.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

Explain the difference between method overriding and method overloading in C++?

1 Answers   Accenture,


How to convert integer to string in C++

1 Answers  


In C++ what is the meaning of data hiding?

1 Answers   Aricent,


What are string library functions(syntax).

1 Answers   Accenture,


What is an abstract class in C++

1 Answers   SwanSoft Technologies,


If class D is derived from a base class B

1 Answers  


How does stack look in function calls? Write a recursive function call, how will the stack look like?

1 Answers   Adobe,


What Is A Default Constructor in C++ ?

1 Answers   Amazon,


Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program for the following values: (a) a = 250, b = 85, c = 25 (b) a = 300, b = 70, c = 70

1 Answers  


Identify the error in the following program. include<iostream> using namespace std; void main() { int num[]={1,2,3,4,5,6}; num[1]==[1]num ? cout<<"Success" : cout<<"Error"; }

1 Answers  


What is placement new?

2 Answers   Amazon,


Tell How To Check Whether A Linked List Is Circular ?

1 Answers   IBS, Infosys,


Categories