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

What is a sequence in c++?

1072


What is linked list in c++?

1176


Explain how a pointer to function can be declared in C++?

1106


What are the benefits of operator overloading?

1271


What is class syntax c++?

1205


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

1018


State the difference between pre and post increment/decrement operations.

1147


What is the array and initializing arrays in c++?

1074


What is encapsulation in c++?

1371


What do you mean by late binding?

1202


What is the difference between c++ and turbo c++?

1297


Are c and c++ similar?

1111


Is the declaration of a class its interface or its implementation?

1227


Can non graphic characters be used and processed in C++?

1244


What is while loops?

1099