What is the difference between constant pointer and pointer
to a constant. Give examples.
Answer Posted / vignesh1988i
Constant pointer :
it is a pointer which points to the same memory location or
to same address and and whatever value the variable which is
pointed by the pointer holds.
for eg :
char a;
char const *p;
p=&a;
here var. a is a memory location having a address and that
variable contains some character data . but this pointer
p points to the same address ( a ) however the value in
var. a changes. finally, THE POINTER POINTED TO AN ADDRESS
IS A CONSTANT ,WHATEVER THE VALUE INSIDE THE VARIABLE MAY BE..
POINTER TO A CONSTANT :
this is a pointer which points to a constant variable
assigned to that pointer. and another pointer can also be
assigned to a same const. variable to point to.
for eg :
char Const a;
char *p,*q;
p=&a;
q=&a;
thank u
| Is This Answer Correct ? | 32 Yes | 0 No |
Post New Answer View All Answers
Is it possible to pass an entire structure to functions?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
When should you use a type cast?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
Why is c so powerful?
What is the difference between #include and #include 'file' ?
write a program to generate address labels using structures?
Explain the difference between call by value and call by reference in c language?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
find the sum of two matrices and WAP for it.
How to create struct variables?
What does c mean in standard form?
Write a program to swap two numbers without using the third variable?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?