#include <stdio.h>
#include <conio.h>
#include <string.h>
main()
{
Char s1[10], S2[10], temp[10];
clrscr();
printf(“ Enter first name\n ”);
scanf(“ %s ”, s1);
printf(“ Enter second name\n ”);
scanf(“ %s ”, s2);
printf(“ Before swapping\n ”);
printf(“ s1 = %s\ts2 = %s\n ”, s1, s2);
strcpy(temp, s1);
strcpy(s1, s2);
strcpy(s2, temp);
printf(“ After swapping\n ”);
printf(“ s1 = %s\ts2 = %s\n ”, s1,s2);
getch();
}
OUTPUT:
Enter first name
Lavanya
Enter second name
Suchita
Before swapping
s1 = Lavanya s2 = Suchita
After swapping
s1 = Suchita s2 = Lavanya
ALSO READ:
-- Program to accept a string and print it by using the while loop.
-- Program to accept a string in upper case and print it in lower case.
-- Program to accept a string in any case and print it by another case.
-- Program to accept a string and print each word in new line.
-- Program to accept a string and count no of capital letters, no. of small letters and no. of special characters.
-- Program to accept a string and find the length of the given string by using functions.
-- Program to accept a string and print the reverse of the given string.
-- Program to accept a string and check whether the given string is palindrome or not.
-- Program to accept two string and compare the strings are equal or not.
-- Program To Find Out The No. Of Times A Character Is Present In The String.
-- Program To Accept A String & Find Out Whether This Character Is Present In The String.
-- Program To Accept A String & Display Number Of Each Vowels.
-- Program To Accept A String & Display Number Of Vowels.
-- Program To Accept A String & Display Vowels.
-- Program To Accept Two Strings & Display Combination Of Two Strings.
-- Program To Accept Two Strings & Display The Largest String.
-- Program To Accept A String & Display It's Alternate Characters In Reverse.
-- Program To Accept A String & Display It's Substring.
-- Program To Accept A String & Display Alternate Characters In Either Case.
-- Program To Accept A String & Display Its Alternate Characters.
-- Program To Accept A String & Display In Reverse.
-- Program To Accept A String & Display It.
-- Program On Strings Into Array Of Pointers.
-- Program To Concatenate Two Strings.
-- Program To Compare Two Strings.
... Back To C Program Index.
have to edit first before it runs.
ReplyDelete