How to access or modify the const variable in c ?

Answer Posted / varunreddy

try this it will work:

#include<stdio.h>
int main()
{
const int i=10;

*(int *)&i=i++;
printf("%d\n",i);

return 0;
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I write a function analogous to scanf?

656


In C language what is a 'dangling pointer'?

639


What are the functions to open and close the file in c language?

593


What is the use of a conditional inclusion statement in C?

601


What is C language ?

1528






What is #include stdio h?

684


Write a program to implement queue.

666


Using which language Test cases are added in .ptu file of RTRT unit testing???

3596


Which is better malloc or calloc?

650


What does d mean?

583


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1591


#include #include struct stu { int i; char j; }; union uni { int i; char j; }; void main() { int j,k; clrscr(); struct stu s; j=sizeof(s); printf("%d",j); union uni u; k=sizeof(u); printf("%d",k); getch(); } what is value of j and k.

5206


Is it possible to use curly brackets ({}) to enclose single line code in c program?

797


What are the key features in c programming language?

614


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

1633