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

What are the 4 types of organizational structures?

828


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

926


You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.

2071


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2114


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

864


Explain the difference between #include "..." And #include <...> In c?

802


What is the description for syntax errors?

845


What are the similarities between c and c++?

809


What is wrong with this program statement?

789


Write a program to print ASCII code for a given digit.

890


What is the total generic pointer type?

930


Explain the difference between null pointer and void pointer.

856


What is define directive?

865


Explain low-order bytes.

821


What is cohesion in c?

748