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

What are types of structure?

593


What is pointer to pointer in c language?

583


What is the method to save data in stack data structure type?

592


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

1552


Write a program for Overriding.

666






What is a function in c?

561


How can I change their mode to binary?

680


what will be maximum number of comparisons when number of elements are given?

1395


Explain what standard functions are available to manipulate strings?

597


What is the difference between near, far and huge pointers?

616


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

1851


When is a null pointer used?

624


Explain what is page thrashing?

597


Write a program to check palindrome number in c programming?

585


What is the use of define in c?

578