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

write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.


How many levels of pointers can you have?


how to write optimum code to divide a 50 digit number with a 25 digit number??


Differentiate between declaring a variable and defining a variable?


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }


what are the advantages of a macro over a function?


Why do we use namespace feature?


What are the difference between a free-standing and a hosted environment?


hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?


What is the code for 3 questions and answer check in VisualBasic.Net?


Explain how does free() know explain how much memory to release?


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;


What are runtime error?


How can I copy just a portion of a string?


What are disadvantages of C language.