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
Does c have function or method?
What is ## preprocessor operator in c?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Can include files be nested? How many levels deep can include files be nested?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
What is string in c language?
Which of these functions is safer to use : fgets(), gets()? Why?
What are c identifiers?
What is cohesion and coupling in c?
How can I dynamically allocate arrays?
In C language, a variable name cannot contain?
What is the meaning of 2d in c?
What is the difference between typedef struct and struct?
What is a far pointer in c?
Differentiate call by value and call by reference?