I've been working through this code for hours but couldn't locate the error. It passes the compiler, but while running it gets a bus error, why?
char *ft_strrev(char *str);
char *ft_strrev(char *str)
{
int i;
int count;
int d;
char temp[5];
i = 0;
count = 0;
d = 0;
while (str[count] != '\0')
{
count++;
}
while (d < count)
{
temp[d] = str[d];
d++;
}
while (--count >= 0)
{
str[i] = temp[count];
i++;
}
return (str);
}
int main()
{
char *pooch;
pooch = "allo";
ft_strrev(pooch);
return (0);
}