#include<stdio.h>
void copystr(char [],char []);
void main()
{
char str1[50],str2[50];
printf("Enter 1st string,str1 : ");
gets(str1);
printf("\nEnter 2nd string,str2 : ");
gets(str2);
copystr(str1,str2);
printf("\n\nAfter copying str2 in str1\n\nstr1 is %s ",str1);
getch();
}
void copystr(char txt1[], char txt2[])
{
int i;
for(i=0;txt2[i]!='\0';i++)
{
txt1[i]=txt2[i];
}
txt1[i]='\0';
}
Monday, July 31, 2017
Home »
C Programming
» Copying string 2 to string 1
Copying string 2 to string 1
Related Posts:
Graphics in C#include <windows.h> #include <stdio.h> void SetColorAndBackground(int ForgC, int BackC); void main() { int f,b; system("cls"); printf("Enter … Read More
Check if a string is palindrome or not in C ?#include<stdio.h> #include<string.h> void main() { char word[50]; int i,j,l,c=0; printf("Enter a word : "); gets(word); l=strlen(word); … Read More
Check if 3rd digit of a no. is prime or not in C ?#include<stdio.h> int digitcount(int x) { int r,c=0,i=0,y=x; while(x!=0) { r=x%10; x=x/10; c+… Read More
Application of struct in C#include<stdio.h> #include<string.h> struct student { char name[20]; int roll; }; void main() { struct student s[10],t; int i,n,j; printf("Enter no. of students : "… Read More
Simple quiz in C#include<stdio.h> #include<conio.h> #include <windows.h> #include<ctype.h> #include<stdlib.h> #include<time.h> #include<dos.h> void displayscore() { char name[20]; … Read More
0 comments:
Post a Comment