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
Explain what is #line used for?
Explain void pointer?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What are the different types of linkage exist in c?
What language is c written?
What are the parts of c program?
What are the functions to open and close file in c language?
Write the Program to reverse a string using pointers.
What are qualifiers and modifiers c?
Not all reserved words are written in lowercase. TRUE or FALSE?
What is the use of getchar() function?
What is p in text message?
Why does the call char scanf work?
what is stack , heap ,code segment,and data segment
what is the syallabus of computer science students in group- 1?