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...

How to write a program for swapping two strings without
using 3rd variable and without using string functions.

Answer Posted / gaurav rustagi

#include <iostream>
#include <string.h>
using namespace std;
void swap ( char ** , char ** ) ;
int main ()
{
char * buyer= "US Dollars" ;
char * seller = "IN Ruppees" ;

cout << "Before swap, buyer has " << buyer;
cout << " and seller has " << seller << endl;

swap (buyer,seller);

cout << " After swap, buyer has " << buyer;
cout << " and seller has " << seller << endl;

return 0;
}
void swap ( char ** L , char ** R )
{
char ** temp = R;
R = L ;
L = temp ;
}

Is This Answer Correct ?    7 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of realloc()?

1198


What are the rules for identifiers in c?

1119


What are different types of variables in c?

1126


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

1214


How do we make a global variable accessible across files? Explain the extern keyword?

1937


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

2431


What are loops in c?

1065


What is meant by operator precedence?

1202


can we implement multi-threads in c.

1177


What is the difference between array and pointer in c?

1222


What is auto keyword in c?

1250


Where register variables are stored in c?

1000


What are operators in c?

1077


Are there namespaces in c?

1187


Can the size of an array be declared at runtime?

1144