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 the difference between abs() and fabs() functions?
Explain why can’t constant values be used to define an array’s initial size?
How to create struct variables?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is the difference between int main and void main?
Is c pass by value or reference?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What is a macro?
What is the difference between typedef struct and struct?
What are valid operations on pointers?
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
What are variables c?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]