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 will you write a code for accessing the length of an array without assigning it to another variable?

999


How can I call fortran?

987


Explain high-order and low-order bytes.

1046


What are terms in math?

978


In C programming, what command or code can be used to determine if a number of odd or even?

988


What are formal parameters?

1062


What's a good way to check for "close enough" floating-point equality?

1092


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

1092


What are header files and explain what are its uses in c programming?

1063


Why can arithmetic operations not be performed on void pointers?

980


Why is c so popular?

1115


Can a pointer be static?

1015


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

1352


What is pointer to pointer in c language?

1045


When c language was developed?

1007