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 |
An array name contains base address of the array. Can we change the base address of the array?
What is pointers in c with example?
what are the uses of structure?
Is c functional or procedural?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
why integer range between -327680to+32767
write a program to find lcm and hcf of two numbers??
What is information technology.
. Consider the following program main() { int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is (A) 1 (B) 3 (C) -6 (D) none
Can a void pointer point to a function?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
A marketing company wishes to construct a decision table to decide how to treat clients according to three characteristics: Gender, City Dweller, and age group: A (under 30), B (between 30 and 60), C (over 60). The company has four products (W, X, Y and Z) to test market. Product W will appeal to female city dwellers. Product X will appeal to young females. Product Y will appeal to Male middle aged shoppers who do not live in cities. Product Z will appeal to all but older females.