samedi 30 décembre 2017

What really is constant? Definition

I'm getting a little confused about constant. It says here in Programming Principles and Practice Using C++ book that you cannot give a new value to constant.

constexpr int max = 17;
int val = 19;
max+2

but this code is confusing me. max+2, that means the max will have a new value, 19, so what really is constant? how come you can add 2 to a constant?

Aucun commentaire:

Enregistrer un commentaire