Write a function which takes a character array as input and
reverses it in place.
Answer Posted / gumnam
void reverse(char *a)
{
char tmp;
int len = strlen(a) - 1;
for (int i = 0; i < len/2; i++)
{
tmp = a[i];
a[i] = a[len - i];
a[len - i] = tmp;
}
}
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
How would you call C functions from C++ and vice versa?
Can a Structure contain a Pointer to itself?
How to defines the function in c++?
What is the function of I/O library in C++ ?
What are arithmetic operators?
Difference between delete and free.
How do you save a c++ program?
Which format specifier is used for printing a pointer value?
What is recursion?
Can comments be longer than one line?
Is c better than c++?
What are move semantics?
How do you print a string on the printer?
What are the four partitions in which c++ compiler divides the ram?
What is the difference between equal to (==) and assignment operator (=)?