wats the diference btwen constant pointer and pointer to a
constant.pls give examples.
Answer Posted / rudra prasad panda
Pointer is a variable containing the addres of another
variable;
Constant pointer is a variable which points to a variable
constantly.it means that , once it is initialised,it cannot
be changed.Till the end of program,it points to that
variable only;
EXAMPLE:
char k,m;
const char *p=&k;
p=&m;//(syntax error)
********
A pointer to a constant is a pointer such that the contents
of the variable(pointed by the pointer)cannot be modified
throuhg the pointer;
EXAMPLE:
char m='l';
char * const p;
p=&m;
*p='u';//syntax error
m='k';//no syntax error
| Is This Answer Correct ? | 8 Yes | 42 No |
Post New Answer View All Answers
Why structure is used in c?
How can type-insensitive macros be created?
Write a program of advanced Fibonacci series.
Describe the difference between = and == symbols in c programming?
When is the “void” keyword used in a function?
What are bitwise shift operators in c programming?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
What does c mean?
Linked lists -- can you tell me how to check whether a linked list is circular?
What is anagram in c?
What is difference between Structure and Unions?
What is I ++ in c programming?
What is the use of typedef in c?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Tell me can the size of an array be declared at runtime?