字符串结束标志
'\0'是字符串的结束标志吧,可以修改么?我的意思是,能不能自己修改字符串的结束标志...
例如:scanf("%s",str);将结束标志修改为'+'
当输入+号是,就结束了字符串的输入.
2009-09-01 13:30
2009-09-01 13:42
程序代码:#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;
}
2009-09-02 06:49
2009-09-02 11:04
2009-09-02 17:32
2009-09-02 18:37
2009-09-07 18:28
2009-09-12 10:44
2009-09-12 12:33