Const (computer programming): Difference between revisions

Content deleted Content added
I added more information about the use of `const` in other programming languages, and specified that not only the mentioned ones are the ones who use it.
Line 1:
{{short description|Type qualifier}}
{{lowercase title}}
In the [[C (programming language)|C]], [[C++]], [[D (programming language)|D]], [[JavaScript]] and, [[Julia (programming language)|Julia]], [[Rust (programming language)|Rust]]s, '''const''' is a [[typeProgramming qualifierlanguage|programming languages]]:{{efn|In, Damong the termothers, ''type constructor'const' is used instead of ''type qualifier,''is by analogy witha [[Constructortype (object-oriented programming)|constructors in object-oriented programmingqualifier]].}}: a [[Keyword (computer programming)|keyword]] applied to a [[data type]] that indicates that the data is read only. While this can be used to declare [[Constant (computer programming)|constants]], <code>const</code> in the C family of languages differs from similar constructs in other languages in being part of the ''type,'' and thus has complicated behavior when combined with [[Pointer (computer programming)|pointers]], references, [[composite data type]]s, and type-checking. In other languages like [[Rust (programming language)|Rust]], the data is not in a single memory ___location, but copied at compile time on each use<ref>{{Cite web |title=Constant items - The Rust Reference |url=https://doc.rust-lang.org/reference/items/constant-items.html |access-date=2022-06-22 |website=doc.rust-lang.org}}</ref>.
 
== Introduction ==