What does const do when declaring a variable

Declaring variables with const might make them static values that cannot be changed later. I do wonder if there’s temporary variables and how this works alongside a const variable.

1 Like

You’re right.

Be wary of referring to them as static however, that’s a whole different thing. Using static with variables in the context of a class is almost like a global value. The variable then has the same across all instances of the class. Also, static variables can be altered whereas const variables cannot.