Write a function which takes a character array as input and
reverses it in place.
Answer Posted / arun
#include<iostream>
using namespace std;
void reverse(char *a)
{
char *tmp = new char[strlen(a)];
memset(tmp,0,strlen(tmp));
int a1 = strlen(a);
a1 =a1-1;
for (int i = a1;i>=0; i--)
{
tmp[a1-i] = a[i];
}
cout<<tmp<<" "<<strlen(tmp)<<endl;
}
void main()
{
char *name = "Xerox";
reverse(name);
}
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is a syntax in c++?
daily Routine of father
What is an operator function? Describe the function of an operator function?
Write a program using merge () function to combine the elements of array x[ ] and y[ ] into array z[ ].
Write about c++ storage classes?
Why do you use the namespace feature?
What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?
How can I learn dev c++ programming?
Is c++ primer good for beginners?
Differentiate between an array and a list?
What is type of 'this' pointer?
What is an iterator class in c++?
What are all predefined data types in c++?
What is the difference between function overloading and operator overloading?
What is the prototype of printf function?