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

Posted By: Michael Evans     Category: C Programming     Views: 3402

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 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 OF B INTO A IS  %s .",a);
    getch();
}


--------------------------------- OUTPUT ---------------------------------


 Please Give The STRING OF A : SHAH    

 Please Give The STRING OF B : NAYAN    



 AFTER COPYING STRING OF B INTO A IS  NAYAN


--------------------------------------------------------------------------
  
Share: 



Michael Evans
Michael Evans author of Program to copy one string s2 to another string s1 without using strcopy function 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!