The following code shows a segmentation error. How to solve the problem? What is the problem with the code?
#include <stdio.h>
void stcp (char *, char *);
int
main ()
{
char *s = "This is first string";
char *t = "string to be copied";
stcp (s, t);
printf ("%s", s);
getch ();
}
void
stcp (char *s, char *t)
{
while ((*s++ = *t++) != '\0');
}