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
Explain linear search.
Which c++ compiler is best?
How can I learn c++ easily?
What is decltype c++?
What relational operators if statements in c++?
Why do we use using namespace std in c++?
What are associate containers?
Why pointer is used in c++?
What are put and get pointers?
What are the advantages of c++?
How many types of modularization are there in c++?
When one must use recursion function? Mention what happens when recursion functions are declared inline?
Explain this pointer?
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random
What are the advantages of inheritance in c++?