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 is struct node in c?
how to create duplicate link list using C???
please explain every phase in the "SDLC" in the dotnet.
What are the advantages of union?
Explain what is #line used for?
what will be maximum number of comparisons when number of elements are given?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
Differentiate Source Codes from Object Codes
How do I read the arrow keys? What about function keys?
Not all reserved words are written in lowercase. TRUE or FALSE?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
Does sprintf put null character?
What are the application of c?
The difference between printf and fprintf is ?
What are formal parameters?