*/
Written some cool source code? Upload it to Programmer's Heaven.

Other Views

corner
*/

CPLUSPLUS FAQ - How Is Const Keyword Used

How do I use the Const keyword?

Const keyword enables defining of a constant- a variable that cannot be reassigned a new value after initialization. The compiler will catch attempts to modify variables that have been declared const. Here is the syntax:

const float pi = 3.1415;
const int id = 1111;


The variables pi and id now cannot be modified to have any other values.

C++ FAQ Home
corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.