Alternative solution for @j_random_hacker:
char* buffer = new char[32]; strcpy(buffer, "Hello"); reverseString(buffer, buffer + strlen(buffer) - 1); ... rest of your program ... delete[] buffer;
This correctly allocates memory for the C-style string, which can then be changed by any function. Of course, to access strcpy and strlen you need to include the <string.h> header.
source share