void*ft_print_memory(void *addr, unsigned int size)
{
char *memory;
if (size == 0)
return (addr);
memory = (char *)addr;
memory[16] = '\0'; // the error raise from this line
return (addr);
}
I'm new to C programming and working with gcc on MacBook m1 Montery... Does the typecast create variable on stack or heap ? does the typecast create a valid string like malloc ?
called from main
int main (int argc, const char *argv[])
{
char *str;
str = "0123456789abcdefghijklmnopqrstuvwxyz";
ft_print_memory(str, 16);
return (0);
}