ProAnswers.org

Write a C program to copy contents of one string to another string?

#include

#include 

#include 

void main() 

{ 

Char ori[20], dup[20]; 

clrscr(); 

printf(“enter your name:”); 

gets(ori); 

strcpy(dup,ori); 

printf(“original string: %s”, ori); 

printf(“

duplicate string:%s”, dup);

getch(); 

} 

Output: 

Enter your name: SAM 

Original string: SAM 

Duplicate String: SAM