We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
Answer / Pushpendra Kumar Chahal
In C++, if a const variable is declared within a function, it does not need to be initialized at the time of declaration because its initial value is assumed to be garbage or unspecified. However, it must be assigned a definite value before it is used. This applies to the example where p is a local variable.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the unique features of C++.
Is c++ a high level language?
When should overload new operator on a global basis or a class basis?
What are function poinetrs? where are they used?
Why namespace is used in c++?
How is objective c different from c++?
Define 'std'.
How to write a program such that it will delete itself after exectution?
What are stacks?
Why is the function main() special?
Describe protected access specifiers?
What is the purpose of template?