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
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
How reliable are floating-point comparisons?
What is 2 d array in c?
How many types of errors are there in c language? Explain
What is a function in c?
Explain c preprocessor?
What happens if a header file is included twice?
Why c is called a mid level programming language?
Are pointers really faster than arrays?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Is null a keyword in c?
What is the -> in c?
Can you apply link and association interchangeably?