C: “zsh: abort” error
问题 Here's my program: #include <stdio.h> char *ft_strcat(char *dest, char *src) { int i; int k; i = 0; k = 0; while (dest[i]) i++; while (src[k]) { dest[i + k] = src[k]; //i++; k++; } dest[i + k] = '\0'; return (dest); } int main(){ //ft_strcat char str[] = "Hello, "; char str2[] = "World!"; printf("%s", ft_strcat(str, str2)); return 0; } It's implementing of strcat function. When I'm trying to copy "World!" to "Hello, " I have an error "zsh: abort". There's no problem when I'm trying to copy to