How to access or modify the const variable in c ?

Answer Posted / sri harsha s

Its compiler dependant.
Using pointer you can modify the content of a 'const'
variable. It works in gcc.. you will get the following
warning when you compile that program.

warning: initialization discards qualifiers from pointer
target type.

I am not sure about turbo c++.

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If errno contains a nonzero number, is there an error?

763


What is typedef example?

598


What is the sizeof () operator?

594


What is volatile variable in c with example?

568


Why do we need a structure?

563






What is #define?

547


Can you mix old-style and new-style function syntax?

634


What is declaration and definition in c?

498


Why pointers are used?

600


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

694


What is the collection of communication lines and routers called?

590


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

574


How do you initialize pointer variables?

578


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

677


Explain how can I avoid the abort, retry, fail messages?

562