This is how I do it:
void setup() {
Serial.begin(9600);
while (!Serial) {} //wait for Serial Monitor to be opened on boards such as Leonardo/Micro/etc.
char buffer[4]; //create a buffer array large enough to hold the string and terminator
test(buffer); //pass the buffer to the function
Serial.println(buffer); //buffer now contains the string
}
void loop() {}
void test(char testBuffer[]) {
const char string[] = "abc";
strcpy(testBuffer, string); //copy the string to the buffer
}
Please always do Tools > Auto Format on your code before posting it to the forum.
Please always use code tags(</> button on the toolbar) when you post code or error/warning messages.