The difference between const char *, char const *, char * const in C/C++

  1. const char *ptr
    defines a pointer to a character constant.
    The pointer points can be modified, but the value pointed to by the pointer cannot be modified.

  2. char const *ptr
    is equivalent to 1

  3. char * const ptr
    defines a pointer constant to a character.
    The pointer point cannot be modified, and the value pointed to by the pointer can be modified

Guess you like

Origin blog.csdn.net/qq_42138927/article/details/107039499