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

What are the advantages and disadvantages of a heap?

921


Why c language?

841


stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

2157


What are types of functions?

765


Write a program to print fibonacci series using recursion?

830


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

803


Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?

1813


How can my program discover the complete pathname to the executable from which it was invoked?

855


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

836


What is static function in c?

840


How do shell structures work?

790


What is fflush() function?

886


Explain how are portions of a program disabled in demo versions?

873


Explain what is the difference between #include and #include 'file' ?

789


What are the back slash character constants or escape sequence charactersavailable in c?

928