Choose Category
#include<stdio.h> #include<string.h> #include<malloc.h> #include<conio.h> main() { char first[50], second[50], *temp; printf("Enter string1 "); gets(first); printf("Enter string2 "); gets(second); printf("\nInitial status\n"); printf("First string: %s\n",first); printf("Second string: %s\n\n",second); temp = (char*)malloc(100); strcpy(temp,first); strcpy(first,second); strcpy(second,temp); printf("After Swapping\n"); printf("First string: %s\n",first); printf("Second string: %s\n",second); getch(); return 0; }