Constant Variables in C#

Mannan Ul Haq
0

`const` Variables:

  • A `const` variable is a read-only variable whose value cannot be changed once it is assigned.
  • It is declared using the `const` keyword.
  • `const` variables must be initialized at the time of declaration.

Here's an example:


const int MAX_VALUE = 100;


In this example, `MAX_VALUE` is a `const` variable with a value of 100. Its value cannot be modified throughout the program.

Tags

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Accept !