What does this function do:

What does this function do:

string f(const string &x) {
return x.empty()? x : f(x.substr(1)) + x[0];
}

What does this piece of code perform:

char *a=...., *b=....;
while(*b++ = *a++);

Questions by Namataraginu

Showing Answers 1 - 15 of 15 Answers

rsuzoka

  • Mar 22nd, 2008
 

Yeah, the first one reverses the string. I'm not too sure about the second one - it looks more like comparing two strings, rather than copying one to another.

Any other comments????

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions