Write a c program to swap 2 strings.
#include
#include
#include
void main()
{
char s1[20], s2[20], temp[20];
clrscr();
printf("Enter 1st String : ");
gets(s1);
printf("Enter 2nd String : ");
gets(s2);
strcpy(temp,s1);
strcpy(s1,s2);
strcpy(s2,temp);
printf("\nString after Swapping :);
printf("\nString1 : %s",s1);
printf("\nString2 : %s",s2);
getch();
}
/*Output
Enter 1st String : Microsoft OS
Enter 2nd String : Intel Processor
Strings after Swapping :
String1 : Intel Processor
String2 : Microsoft OS
*/
Shopping In MUMBAI
Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top.
Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.
Monday, December 29, 2008
C program to swap 2 strings
Posted by ars at 11:51 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment