I encountered this issue while testing around printf.
This code outputs 5, which is what I want.
#include <stdio.h>
size_t ft_strlen(const char *str)
{
size_t i;
while (*str++)
i++;
return (i);
}
int main(void)
{
printf("%zu\n", ft_strlen("Hello"));
return (0);
}
But, when I declare a char *str;
above my printf, the output shows 4294967301
Why is the printf affected by the above declaration ?