Logic:-
For this problem, you can use two methods one method is Using Library Function and secondly is Without Using Library Function. Here we are going through second method copy one string to in another without using inbuilt functions for that we are taking an input from the user after that with the help of "For Loop" copying character by character fro one string to another. Below are both methods(using library function and without using library function) you can try both.
Using Library Function
strcpy:- You can use strcpy() for copy one string to another string syntax is given below
Syntax:-
strcpy (destination, source)
it will copy a string from source and paste into a string in the destination.
Without Using Library Function
Here you can use a loop(For Loop And While Loop recommended ) and copy character by character from one string to another string.
Syntax:-
for(i=0; s1[i]!='\0'; ++i)
{
s2[i]=s1[i];
}
Output:
Enter The String S1: mohamad
Copied String S2 is : mohamad
need an explanation for this answer? contact us directly to get an explanation for this answer