Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
bool check(const char* pass);
const 是否意味着我不能在函数内部修改 char*?
char* c 是否有类似 contains(char c) 的函数来检查 char 是否在 char* 中?
如何到达 char* 中的第 4 个字符?
是否有任何函数可以给出该 char* 的长度。除了检查'\0'在哪里?
改为使用std::string。
std::string
不,这意味着您不能修改chars.
char
char*是一个指针,它没有任何功能。你可以抬头看看strchr。
char*
strchr
pass[3]
strlen'\0',但它会在内部进行检查。
strlen
'\0'