In-place function

  • Thread starter peter.mcclymont
  • Start date
P

peter.mcclymont

Hi There,

Can you please help me write an in-place function in C++ for reversing
a string.

What is an in-place function?

So what is a non-in-place function in that case to reverse a C++
string?

Urgent help needed.

Thanks,

Peter.
 
Y

yuvalif

What is an in-place function?
Function that works without additional memory allocation.
In fact, constant additional memory may be allocated, but the amount of
additional memory should not be depended with the input.
Non-in-place is just the opposite...

The question sounds like homework, so the general idea will be to
implement a "swap" function (with a temporary variable), only that the
two arguments to swap are pointers to the start/end of the string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top