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 / saptarshi

void main()
{
char *p="string1";
char *q="string2";

p^=q^=p^=q;
printf("%s,%s",p,q);
}

swapping the base pointers of the two strings may work...
if they are declared as character arrays, then it is not
possible as we cannot modify the value of array base
pointers...

Is This Answer Correct ?    10 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2923


Explain what header files do I need in order to define the standard library functions I use?

1223


How can I write a function analogous to scanf?

1225


What is the heap in c?

1123


How do you print only part of a string?

1065


What is the difference between local variable and global variable in c?

1283


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

2135


Calculate 1*2*3*____*n using recursive function??

2095


How reliable are floating-point comparisons?

1140


What are the types of data types and explain?

1129


Why do we use return in c?

1044


How many bytes are occupied by near, far and huge pointers (dos)?

1216


What is the explanation for modular programming?

1268


What does s c mean in text?

1141


What is abstract data structure in c?

1104