What I think the term const is

After using this code:

const int a = 4;
a = 5;

I get: error C3892: ‘a’: you cannot assign to a variable that is const

Using this error and my previous experience in other languages, I believe that const is short for constant, and that it tells the compiler that a variable with the const declaration should never be changed for any reason. This can be very useful when you have variables that you don’t want to ever change whether that be due to player input, a mistake in the code, or anything you can think of that would cause a variable to change.

Privacy & Terms