字符串结束标志
'\0'是字符串的结束标志吧,可以修改么?我的意思是,能不能自己修改字符串的结束标志...
例如:scanf("%s",str);将结束标志修改为'+'
当输入+号是,就结束了字符串的输入.
#include <iostream> #include <cstdio> using namespace std; int main() { char s[100] = {}; cout << "Enter a character string which ends with '+' : "; scanf("%[^+]+", s); cout << "s : [" << s << "]" << endl; }