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 the difference between abs() and fabs() functions?
Explain high-order bytes.
How a string is stored in c?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Can one function call another?
What are qualifiers in c?
Explain how can I pad a string to a known length?
Is it possible to pass an entire structure to functions?
What is difference between constant pointer and constant variable?
What do the functions atoi(), itoa() and gcvt() do?
What is spark map function?
simple program of graphics and their output display
Which is the best website to learn c programming?
Can a local variable be volatile in c?
What is pointers in c with example?