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

Explain what is a pragma?

1049


How do I determine whether a character is numeric, alphabetic, and so on?

1135


How can I make it pause before closing the program output window?

1043


How do you search data in a data file using random access method?

1304


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

2178


Explain the difference between strcpy() and memcpy() function?

1007


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4688


Explain b+ tree?

1067


Is javascript based on c?

1065


What is the use of #include in c?

1085


How to set file pointer to beginning c?

1203


write a progrmm in c language take user interface generate table using for loop?

2050


When can you use a pointer with a function?

1069


Explain what is the difference between far and near ?

1112


Explain what is the difference between the expression '++a' and 'a++'?

1214