Const

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.

Advertisements

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.

Advertisements

Related Terms

Latest Programming Languages Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…