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
What do you mean by vtable and vptr in c++?
Using a smart pointer can we iterate through a container?
What is the full form of stl in c++?
What is helper in c++?
What are the uses of pointers?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;
When should overload new operator on a global basis or a class basis?
What do you mean by global variables?
What is a character in c++?
What is singleton pattern in c++?
How to access a variable of the structure?
How do I write a c++ program?
What are references in c++? What is a local reference?
Difference between declaration and definition of a variable.
Explain what are single and multiple inheritances in c++?