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

How would you use the functions fseek(), freed(), fwrite() and ftell()?

1119


What are the different categories of functions in c?

1110


When should the volatile modifier be used?

1126


What is pre-emptive data structure and explain it with example?

3680


How will you declare an array of three function pointers where each function receives two ints and returns a float?

1316


Why c is called a mid level programming language?

1042


Difference between Function to pointer and pointer to function

1037


How do I use void main?

1067


What are the 5 types of inheritance in c ++?

985


What is difference between union and structure in c?

1099


Why is c so popular?

1130


Explain what is the difference between #include and #include 'file' ?

987


What is page thrashing?

1038


Why is c called a structured programming language?

1233


What is huge pointer in c?

1040