strstr函数的返回类型为什么是char*而不是const char* ?
Synopsis
#include <string.h>
char *strstr(const char *s1, const char *s2);
Description
The strstr function locates the first occurrence in the string pointed to by s1 of the
sequence of characters (excluding the terminating null character) in the string pointed to by s2.
Returns
The strstr function returns a pointer to the located string, or a null pointer if the string
is not found. If s2 points to a string with zero length, the function returns s1.
以上内容摘自ISO C99标准。这个函数要返回的是s1经过偏移后的值,而不是把s1复制一份返回。那么,既然s1是const char*,返回的类型也应该是const char* 啊!
补充:软件开发 , Java ,