Constants - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Sunday 5 November 2017

Constants

A constant is an identifier with an associated value which cannot be altered by the program during execution.
How to declare constant variable ?
We can declare constant variable using const keyword.
Example of declaring constant variable


    //Syntax for declaring constant variable
    data type const variable_name = value;

    //float constant
    float const pi = 3.14;

    //integer constant
    int const a = 5;

    //character constant
    char const yes = 'y';

No comments:

Post a Comment

Post Top Ad