strcpy报错,要怎么改代码

struct stringy 

{

char * str;

int ct;

};

void set(stringy & s, const char * t);

int main()

{

stringy beany;

char testing[] = "Reality isn't what it used to be.";

set(beany, testing);

        return 0;

}

void set(stringy & s, const char * t)

{

s.ct = strlen(t);

s.str = new char[s.ct + 1];

strcpy(s.str, t);

}


慕田峪3750655
浏览 2171回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP