What is the difference between constant pointer and pointer
to a constant. Give examples.
Answer Posted / santosh
Pointer to constant: If pointer is pointing to constant
variable is caller pointer to constant. We can not change
the value of that constant.
const int constVariable = 6;
int *ptrConstVar = &constVariable;
Constant Pointer: We declare a pointer as constant. We can
change the content pointed by pointer. But we can not do any
airthmatic operation on the pointer like increment or decrement.
int localVariable =10;
const int *p = &localVariable;
we can not do p++ or p--;
| Is This Answer Correct ? | 23 Yes | 8 No |
Post New Answer View All Answers
What is structure of c program?
Explain can static variables be declared in a header file?
Which is an example of a structural homology?
write a c program to find the sum of five entered numbers using an array named number
What do you mean by dynamic memory allocation in c?
Explain a pre-processor and its advantages.
What are the advantages of union?
What is register variable in c language?
What is the scope of global variable in c?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
What is the Purpose of 'extern' keyword in a function declaration?
How can you find out how much memory is available?
Explain the difference between structs and unions in c?
What is an endless loop?
Explain what is the difference between the expression '++a' and 'a++'?