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

Why is this loop always executing once?

617


what is stack , heap ,code segment,and data segment

2223


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

1631


List some of the dynamic data structures in C?

790


What does int main () mean?

551






Explain how do you determine a file’s attributes?

594


Explain what is #line used for?

608


What are valid operations on pointers?

669


Which is more efficient, a switch statement or an if else chain?

583


What is extern keyword in c?

645


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2000


explain what is a newline escape sequence?

690


Write a code to generate divisors of an integer?

642


string reverse using recursion

1812


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

762