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
When should volatile modifier be used?
Is main an identifier in c?
How can you convert integers to binary or hexadecimal?
Is that possible to add pointers to each other?
How is pointer initialized in c?
What is a const pointer?
What are nested functions in c?
What is realloc in c?
What are the data types present in c?
C language questions for civil engineering
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
The statement, int(*x[]) () what does in indicate?
Explain what are binary trees?
Can we declare variable anywhere in c?
Do you know pointer in c?