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 NULL pointer?

1107


Do you know the purpose of 'register' keyword?

1023


Why c is called object oriented language?

1075


What are integer variable, floating-point variable and character variable?

1267


What are operators in c?

1034


What is stack in c?

1088


Are bit fields portable?

1165


What is the difference between a function and a method in c?

1095


Why functions are used in c?

1146


Should a function contain a return statement if it does not return a value?

1092


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1177


Is that possible to add pointers to each other?

1379


What is the most efficient way to store flag values?

1197


What are dangling pointers? How are dangling pointers different from memory leaks?

1330


How many bytes is a struct in c?

1177