Program for string function strcpy() in c programming language


/*C Program for string function strcpy() in c programming language*/.

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
  char str1[20],str2[20];
  clrscr();
  puts("Enter your strings : ");
  gets(str1);
  puts("Enter another string :");
  gets(str2);
  puts("\nThe previous entered strings are :");
  puts(str1);
  puts(str2);
  strcpy(str1,str2);
  puts("\nAfter copying strings are :");
  puts(str1);
  puts(str2);
  getch();
}
===============================
OUTPUT:- 
Enter your strings :
c program                                                                       
Enter another string :                                                         
computer                                                                       
                                                                               
The previous entered strings are :                                             
c program                                                                      
computer                                                                        
                                                                               
After copying strings are :                                                    
computer                                                                        
computer          

Comments