#include<conio.h>
void stcpy(char str1[50], char str2[50]);
void main()
{
char str1[50], str2[50];
clrscr();
printf(“nnt ENTER A STRING…: “);
gets(str1);
stcpy(str1,str2);
printf(“nt THE COPIED STRING IS…: “);
puts(str2);
getch();
}
void stcpy(char str1[50], char str2[50])
{
int i, len = 0;
while(str1[len]!=’′)
len++;
for(i=0;i<len;i++)
str2[i] = str1[i];
str2[i] = ‘′;
}
Not Satisfied ? Just search & get the result
Related posts:
- C program – Copy the contents of one string to another string using pointer
- C program To reverse the given string
- C Program to accepts two strings and compare them. Finally it prints whether both are equal, or first string is greater than the second or the first string is less than the second string
- C program – Morse code to text conversion and vice-versa.
- C Program to accept two strings and concatenate them i.e.The second string is appended to the end of the first string
