char* vs const char* as a parameter

后端 未结 5 542
逝去的感伤
逝去的感伤 2021-01-30 05:10

There are many times that I get compile errors when I use char* instead of const char*. So, I am not sure the actual difference, the syntax and the com

5条回答
  •  我在风中等你
    2021-01-30 05:48

    • char *       : non-constant pointer to non-constant character
    • const char *    : non-constant pointer to constant   character
    • char *const     : constant   pointer to non-constant character
    • const char * const : constant   pointer to constant   character


    Reference [link]

提交回复
热议问题