strcpy program not working

#include<stdio.h>
#include<string.h>
char xstrcpy(char *,char *);
int main ()
{
char source[]="You";
char target[]="Hello";
xstrcpy(target,source);
printf("%s",source);
printf("%s",target);
}
char xstrcpy(char *t,char *s)
{
while(s!='\0')
{
*t=*s;
s++;
t++;
}
*t='\0';
}
Change while(s!='\0') -> while(*s!='\0') // Note: *s
Bloody hell of course!
Thanks mate
Topic archived. No new replies allowed.