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
What is a buffer in c?
What is a list in c?
What is a far pointer in c?
How do I create a directory? How do I remove a directory (and its contents)?
Explain the properties of union.
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
Explain what is wrong with this program statement?
using only #include
Explain bitwise shift operators?
How is a macro different from a function?
What are the types of unary operators?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
is it possible to create your own header files?
Write a program to check whether a number is prime or not using c?
What is the time and space complexities of merge sort and when is it preferred over quick sort?