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
Why & is used in c?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
How do we make a global variable accessible across files? Explain the extern keyword?
In a header file whether functions are declared or defined?
Explain what is the use of a semicolon (;) at the end of every program statement?
What is the use of putchar function?
Which type of language is c?
Should a function contain a return statement if it does not return a value?
How do you declare a variable that will hold string values?
What is the use of pointers in C?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
When should the volatile modifier be used?
What are qualifiers in c?
What are the loops in c?
What does c mean in standard form?