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 is upcasting in C++?
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
Are there any special rules about inlining?
Which field is used in c++?
What do the keywords volatile and mean mutable?
How to declare an array of pointers to integer?
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?
Can a new be used in place of old mallocq? If yes, why?
How the programmer of a class should decide whether to declare member function or a friend function?
find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.
What does count ++ do in c++?
What is token c++?
Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list
What sorting algorithm does c++ use?
When can I use a forward declaration?