enum and const



enum flag {const1, const2, ..., constN};
const1 = 0 by default

can do const1+1 etc

Changing default values of enum constants

enum suit {
    club = 0,
    diamonds = 10,
    hearts = 20,
    spades = 3,

can initialse from enum

enum week day;

or when defining

enum week{Mon, Tue, Wed}day;

day = Wed;

CONST and modifiable lvalues

use of "const" here? page? motivation? is it actually stored in memory or just compiled?

basically throws an error if you try to modify. still actually stored in memory. eg a function can take a const as an input. variable at compile time. const and run time.

distinction between unmodifiable lvalues and modifiable lvalues

const int a = 1;
a = 2; // bad, even though a is an lvalue.