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
What are the different types of control structures in programming?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
What are identifiers and keywords in c?
What is getch () for?
What is array of structure in c programming?
What is the main difference between calloc () and malloc ()?
What does %p mean?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
What's the best way of making my program efficient?
Why c is called top down?
What is an expression?
How can you increase the size of a statically allocated array?
What is a program flowchart and how does it help in writing a program?
What language is c written?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above