I want to know why doesn't the following work correctly? Though I have tried the other ways that work, but for the sake of more clarity I would like to know the problem occurring here.
char *fuc(char *s)
{
char t[10];
int r=0;
while(s[r] != '\0')
{
t[r] = s[r];
r++;
}
t[r]='\0';
return &t[0];
}
main()
{
char s[]="abcde";
char *p;
p=func(s);
puts(p);
}