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
Answers were Sorted based on User's Feedback
Answer / santhoo035
d)None of the above
It will give compliation error at the line p=&a,pointer to
integer cannot assign to const int
Is This Answer Correct ? | 18 Yes | 1 No |
Answer / madhu
D) NONE OF THE ABOVE
COZ
ANS IS A=101n (*p)=101n
to get this *p should be an constant pointer
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / sridevi.halli
answer is d)none of the above
bcoz in line p=&a it will gve error
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / 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 |
Answer / biranchi ranjan parida
none of the above
pointer value of address increases it cant store its
original value
Is This Answer Correct ? | 0 Yes | 1 No |
what is recursion in C
Can we change the value of #define in c?
What is #pragma statements?
How can I invoke another program from within a C program?
how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......
Can we use any name in place of argv and argc as command line arguments?
what is a constant pointer in C
we have a 3litres jug and a 5 litres jug and no measures on them. using these two jugs how can we measure 4 litres of water?
how to connect oracle in C/C++.
Finding first/last occurrence of a character in a string without using strchr( ) /strrchr( ) function.
What is the difference between mpi and openmp?
design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.