char r[40];
strcpy(r,"abcdef");
strcat(r,r);
My program crashes at the third line?
Replacing strcat(r,r); by strcat(r,"abcdef"); works fine though.... why is that?
According to strcat(3):
The
strcat()function appends the src string to the dest string, overwriting the terminating null byte ('\0') at the end of dest, and then adds a terminating null byte. The strings may not overlap, and the dest string must have enough space for the result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With