instanceof java
Posts: 576
Nickname: instanceof
Registered: Jan, 2015
instanceof java is a java related one.
C program for swapping of two strings
Posted: May 19, 2017 5:21 PM
This post originated from an RSS feed registered with Java Buzz
by instanceof java.
Original Post: C program for swapping of two strings
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java
Advertisement
C program for swapping of two strings. C program to swap two strings without using library functions. Now we will swap two strings without using library functions and by using arrays in java. Now we will write a C program on how to swap two strings.
Program #1 Write a C program to swap two strings #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i=0,j=0,k=0; char str1[20],str2[20],temp[20]; puts("Enter first string"); gets(str1); puts("Enter second string"); gets(str2); printf("Before swapping the strings \n"); puts(str1); puts(str2); while(str1[i]!='\0'){ temp[j++]=str1[i++]; } temp[j]='\0'; i=0,j=0; while(str2[i]!='\0'){ str1[j++]=str2[i++]; } str1[j]='\0'; i=0,j=0; while(temp[i]!='\0'){ str2[j++]=temp[i++]; } str2[j]='\0'; printf("After swapping the strings are\n"); puts(str1); puts(str2); getch(); } Output:
Read: C program for swapping of two strings