study the code:
#include<stdio.h>
void main()
{
const int a=100;
int *p;
p=&a;
(*p)++;
printf("a=%dn(*p)=%dn",a,*p);
}
What is printed?
A)100,101 B)100,100 C)101,101 D)None of the
above
Answer Posted / abdur rab
the answer is c) 101, 101
a constant variable can be accessed using a pointer to
change the value because, during compilation the compiler
cannot see that the pointer is changing a contant read only
variable.
the same method can be applied over the private members in
a c++ class also.
Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What are the two forms of #include directive?
What is data structure in c language?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
cavium networks written test pattern ..
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What is the difference between volatile and const volatile?
How can I trap or ignore keyboard interrupts like control-c?
What is #define?
please explain every phase in the "SDLC" in the dotnet.
What does 3 mean in texting?
what are non standard function in c
What is p in text message?
Explain what is the concatenation operator?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
What is c definition?