Constant Variable

R

Raj Sharma

Hi Guys,
It looks silly but a doubt,
When we declare a variable as a Const where does it stores in Computer?




Raj
 
K

Karl Heinz Buchegger

Raj said:
Hi Guys,
It looks silly but a doubt,
When we declare a variable as a Const where does it stores in Computer?

Depends.
If you never take the address of that const, then chances are high the
the variable never turns up in the final executable. The compiler simply
stores the variables name with the value in a compiler internal table and
whenever that const variable is used, the compiler silently replaces the
variable with the known value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,517
Latest member
Andres38A1

Latest Threads

Top