How to access or modify the const variable in c ?

Answer Posted / saneesh a t

Actually the keyword const is not for the programmer who work with the normal
general purpose computer. By declaring a variable as const, the compailar shows
warning/error to the modification to the variable. At runtime you can modify the memory location
using any technique, or an external hacking program can change the value of the variable.
Suppose your program is compiled to run with a microcontroller with flash or EEPROM or such
memory. Now your variable with const qualifier will be stored in the FLASH of EEPROM memory,
which cann't be modified, and the technique is used to save the RAM space which is too small in
size for a micro controller. In this case too, a FLASH/EEPROM write can chage the value of the
const varriable.

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between null pointer and void pointer.

856


There seem to be a few missing operators ..

819


What is difference between far and near pointers?

797


What is int main () in c?

868


p*=(++q)++*--p when p=q=1 while(q<=6)

1497


Can math operations be performed on a void pointer?

762


What is the use of the function in c?

797


Explain threaded binary trees?

912


What’s a signal? Explain what do I use signals for?

854


Why doesnt that code work?

786


How is pointer initialized in c?

796


What is the difference between single charater constant and string constant?

860


What are the modifiers available in c programming language?

990


What is logical error?

856


while initialization of array why we use a[][2] why not a[2][]...?

2102