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);
} |