1.

What is the difference between const char *p and char * const p ?

A. const char *p – This declares ‘p’ to be a constant pointer to a char. (Char p is modifiable but the pointer isn’t) char * const p – Pointer to a Constant char (‘p’ isn’t modifiable but the pointer is)
B. const char *p – Pointer to a Constant char (‘p’ isn’t modifiable but the pointer is) char * const p – This declares ‘p’ to be a constant pointer to an char. (Char p is modifiable but the pointer isn’t)
C. const char *p – Constant char Pointer (‘p’ and pointer both are modifiable) char * const p – This declares ‘p’ to be a pointer to an constant char. (Char p is modifiable but the pointer isn’t)
D. Since const char and char const is the same, there is no difference.
Answer» C. const char *p – Constant char Pointer (‘p’ and pointer both are modifiable) char * const p – This declares ‘p’ to be a pointer to an constant char. (Char p is modifiable but the pointer isn’t)


Discussion

No Comment Found