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
Comment on local and global scope of a variable.
What is the cout in c++?
Why c++ is called oop?
Write a corrected statement in c++ so that the statement will work properly. if (4 < x < 11) y=2*x;
What is a memory leak c++?
What is basic if statement syntax?
What is ostream in c++?
Is java a c++?
What are pointers used for c++?
How many namespaces are there in c++?
When do we run a shell in the unix system?
What is the function to call to turn an ascii string into a long?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal
What is jump statement in C++?
what is upcasting in C++?