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

How can I ensure that integer arithmetic doesnt overflow?

1173


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

3066


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

3095


What is stack in c?

1083


In a header file whether functions are declared or defined?

1128


Sir i need notes for structure,functions,pointers in c language can you help me please

2421


Mention four important string handling functions in c languages .

1116


int i=10; printf("%d %d %d", i, i=20, i);

1626


How can I do serial ("comm") port I/O?

1184


What is the use of a ‘’ character?

1094


Can an array be an Ivalue?

1099


Define Array of pointers.

1112


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

1237


Difference between goto, long jmp() and setjmp()?

1182


What is a stream water?

1225