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 the keywords volatile and mean mutable?
What is the purpose of the "delete" operator?
What is c++ vb?
What is a hashmap c++?
What do nonglobal variables default to a) auto b) register c) static
What are virtual functions in c++?
Why should we use null or zero in a program?
What is an operator in c++?
How do I run c++?
What is the use of 'this' pointer?
Explain what you mean by a pointer.
Can union be self referenced?
How do you declare A pointer to function which receives an int pointer and returns a float pointer
Can constructor be private in c++?
If a header file is included twice by mistake in the program, will it give any error?