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.
string word = "Hello Boys"; char x[100] = word; // wouldn't work char x[] = word; //wouldn't work either
我很少使用字符串和字符,现在它又回来了。
要将字符串复制到字符数组,可以使用strcpy.
strcpy
示例(未编译):
strcpy (x, word.c_str());
strcpy关于使用apply的所有常见警告;值得注意的是,调用者需要确保它x足够大以容纳word.
x
word