Const

Why Trust Techopedia

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

Margaret Rouse
Technology expert
Margaret Rouse
Technology expert

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.