ProAnswers.org

Write a C program to enter the string and get it‟s duplicate ?

#include

#include 

#include 

void main() 

{ 

Chartext1[20], *text2; 

clrscr(); 

printf(“ Enter text:”); 

gets(text1); 

text2=strdup(text1); 

printf(“original string=%s

duplicate string=%s”, text1, text2);

getch(); 

} 

Output: 

Enter a text: anandamurugan 

Original string: anandamurugan 

Duplicate String: anandamurugan