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.

4268


How many levels of pointers can you have?

4


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

2087


Differentiate between declaring a variable and defining a variable?

1


#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); }

18






what are the advantages of a macro over a function?

26


Why do we use namespace feature?

4


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

21


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?

1071


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

1102


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

3


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

335


What are runtime error?

16


How can I copy just a portion of a string?

6


What are disadvantages of C language.

21