How to access or modify the const variable in c ?
Answer Posted / ramya
const int x = 10;
int *ptr = &x;
*ptr = 20;
printf ("Value of x is %d\n", x);
Even though the variable x is const the value gets changed..
And its one of the drawback in c..
| Is This Answer Correct ? | 28 Yes | 31 No |
Post New Answer View All Answers
Why double pointer is used in c?
What is structure packing in c?
What does sizeof function do?
What is the purpose of void pointer?
What is %d called in c?
What is console in c language?
Is c language still used?
What is #include stdio h?
Which node is more powerful and can handle local information processing or graphics processing?
In C language what is a 'dangling pointer'?
Can we access array using pointer in c language?
How can you pass an array to a function by value?
What is the difference between functions abs() and fabs()?
Explain Basic concepts of C language?
How do you initialize pointer variables?