定义了一个串,然后对串的ch进行赋值,总会出现程序已停止工作,到底怎么回事,求指点。
#include
#include
#define maxsize 50
using namespace std;
typedef struct
{
char ch[maxsize];
int len;
} CHARS;
int main()
{
CHARS *S;
cout<<"please input a string: "<<endl;
cin>>S->ch;
S->len=strlen(S->ch);
cout<<"the S->ch is :"<<S->ch;
return 0;
}