Segmentation fault

#include <stdio.h>
#include<string.h>
void at(char*cp)
{
strcat(cp,"\r\n");
printf("%s",cp);
}

int main()
{
at(“Test”);
printf(“Hello World”);
return 0;
}

Why this code give Segmentation fault?
How to solve this issue??
Thanks.

hhatat:
Why this code give Segmentation fault?

Concatenating to a string constant could be a reason.

The "Test" is a constant, there is no room for adding another characters so strcat causes memory violation.

Which Arduino gives a segmentation error? :o

I guess ESPs.

And there was a bug in one of the gcc-avr toolchains; though that would be a compile error.

Can't you just place the \r\n in the format string in printf?