Hi,
I am getting seg fault when trying to run the code. I don't understand where I made a silly mistake. Can someone help me out please
#include<stdio.h>
#include<string.h>
void xstrcpy(char *, char *);
int main()
{
char *a = "Hello World";
char *p;
xstrcpy(a, p);
return 0;
}
void xstrcpy(char *p, char *q)
{
while(*p != '\0') {
*q = *p;
p++;
q++;
}
*q = '\0';
printf("Copied String: %s", q);
}