what is the difference between
const char *p, char const *p, const char* const p
Answer Posted / kumar krishna
CONST char *p;
here the const. keyword is coming before the "*p"
So it affects the value pointed by "p" i.e. "*p"
You can't change the character (value pointed by p).
Although you can change the address stored in "p".
char CONST *p;
same explanation as above
char * CONST p;
here the const. keyword is coming before the "p" and
after "*" So it affects the value of "p" (which holds
the address). You can't change the address stored in
"p". Although you can change the value pointed by p
i.e. "*p"
CONST char* CONST p:
here CONST is coming before the "*" as well as after
the "*". Therefore, as expeected neither the address
of nor the value pointed by "p" can be changed.
| Is This Answer Correct ? | 170 Yes | 11 No |
Post New Answer View All Answers
Why are algorithms important in c program?
I heard that you have to include stdio.h before calling printf. Why?
How to Throw some light on the splay trees?
If errno contains a nonzero number, is there an error?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
the question is that what you have been doing all these periods (one year gap)
What is a lvalue
formula to convert 2500mmh2o into m3/hr
What is a program flowchart and how does it help in writing a program?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Why c language?
If I have a char * variable pointing to the name of a function ..
What is a scope resolution operator in c?
Is there a way to switch on strings?
What are the 4 types of unions?