178. C Program to Work as Strcpy() Using Pointers.
How does this program work?
- This Program is used to work as strcpy() using pointers.
Here is the code
void copy_string(char*, char*);
main()
{
//To copy string using pointers
char Main[100], New[100];
printf("Enter Main string\n");
gets(Main);
copy_string(New, Main);
printf("New string is \"%s\"\n", New);
return 0;
}
void copy_string(char *New, char *Main)
{
while(*Main)
{
*New = *Main;
Main++;
New++;
}
*New = '\0';
}