Don't miss an insight. Subscribe to Techopedia for free.



What Does Const Mean?

Const is programming syntax that is used to declare a constant variable in languages like C. This is one way of creating a variable that will be used once or many times in code. A constant variable is one that will not change after the program is complied.


Techopedia Explains Const

Using const to create a variable gives that variable definition in terms of its identity within code, but it may not specify an amount of memory storage for the variable without additional syntax. Programmers who have declared a constant variable can declare pointers to that variable, which can be used to return certain arrays or strings from functions.

In some ways, the use of the const indicator is somewhat controversial. Although many see it as an improvement over the #define command in C and related languages, others feel that the use of const can become problematic in parameter passing and other similar uses. For example, it could cause confusion about whether a value needs to be changed.


Related Terms