const char* or char const * means the pointer points to a const variable,you shouldn't change the context of the pointer points to;
char * const means that the pointer is const and you should change the pointer's value(ie.the address that the pointer points to).
const char* 指向常量的指针,不能修改其所指向的内存区的内容,但可以修改所指向的内存地址。
用法如下:
char ch[6] = "Hello";
const char * pStr = ch;
while(*pStr++) //yes;
{
}
*pStr = 'A'; //no
char * const:指针常量,不允许修改指针的值,但是可以修改指针指向内存区内容的值。
char ch[6] = "Hello";
char * const pStr = ch;
*pStr = 'h'; //yes
*pStr++; //no