1 min Reading
1 Comment
C Programming
C Programs
Code, Tutorial and Tricks & Tips
#include <stdio.h> #include <string.h> #include <malloc.h> int main() { char first[100], second[100], *temp; printf("Enter the first string\n"); gets(first); printf("Enter the second string\n"); gets(second); printf("\nBefore Swapping\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); return 0; }
Enter the first string
Code
Enter the second string World55
Before Swapping
First string: Code
Second string: World55
After Swapping
First string: World55
Second string: Code
1 comments
Good bro
ReplyDeleteHere is blog for basic C and C++ programs
List of C and C++ Programs
C and C++ based programs