Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Can you please explain the difference between static and dynamic binding of functions?

971


How do I start a c++ project?

1001


Explain the isa and hasa class relationships.

991


How do I use turbo c++?

938


Is there a sort function in c++?

935


Is c better than c++?

1019


What is enum c++?

1148


Do class method definitions?

983


Show the declaration for a static member variable.

953


If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?

1147


Is overriding possible in c++?

951


Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.

1005


What is name hiding in c++?

1106


What is the difference between a type-specific template friend class and a general template friend class?

930


What is c++ best used for?

1017