Logo 
Search:

C Programming Articles

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

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

Posted By: Jeffrey Washington     Category: C Programming     Views: 11502

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

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

#include<stdio.h>
#include<conio.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);

        for(i=0;b[i]!='\0';i++)
            a[i]=b[i];
        a[i]='\0';
        printf("\n AFTER COPYING STRING B INTO A IS  %s ",a);
        getch();
    }

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

     Please Give The STRING OF A : My

     Please Give The STRING OF B : World

     AFTER COPYING STRING B INTO A IS  World

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



Jeffrey Washington
Jeffrey Washington author of Program to copy one string s2 to another string s1. (Without using strcopy function from string.h) is from Los Angeles, United States.
 
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].

 
Sabeel asghar Asghar from Pakistan Comment on: Jan 06
can you please wrote the same program in c++

Sabeel asghar Asghar from Pakistan Comment on: Jan 06
can you please wrote the same program in c++

View All Comments