Where a constant is stored? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where a constant is stored?

Is a constant object stored in the Stack? It is not going to change, it is static no? ( or I just don't understand what it really means)

21st May 2018, 3:10 PM
Amos
1 Answer
+ 3
Const variables will be stored on the heap as well and behave almost like usual variables except they can't be changed. Using #define (in C for example) won't even create a variable but the compiler will compile those values into the source code (preprocessing). https://code.sololearn.com/cc83ZO3R18qq/?ref=app
21st May 2018, 3:53 PM
Aaron Eberhardt
Aaron Eberhardt - avatar