Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to copy one string s2 to another string s1. (Use strcopy function from string.h)

Posted By: Martha Hughes     Category: C Programming     Views: 2194

Write a program to copy one string s2 to another string
s1. (Use strcopy function from string.h)

Code for Program to copy one string s2 to another string s1. (Use strcopy function from string.h) in C Programming

#include<stdio.h>
#include<conio.h>
#include<string.h>
    void main()
    {
        char a[50],b[50];
        int i,j,n,k;
        clrscr();
        printf("\n Please Give The STRING OF A : ");
        scanf("%s",a);
        printf("\n Please Give The STRING OF B : ");
        scanf("%s",b);
        strcpy(a,b);

        printf("\n AFTER COPYING STRING B INTO A IS  %s .",a);
        getch();
    }


**************************** OUTPUT ********************************************

     Please Give The STRING OF A : Hello

     Please Give The STRING OF B : World

     AFTER COPYING STRING B INTO A IS  World.

********************************************************************************
  
Share: 



Martha Hughes
Martha Hughes author of Program to copy one string s2 to another string s1. (Use strcopy function from string.h) is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!