I already looked with a debugger and i get this error when it leaves the main() function. Here's my Code:
#include <iostream>
char * trim(const char * _str) {
char * newString = new char;
for (int i = 0; i < 10; i++) {
newString[i] = _str[i];
}
newString[10] = '\0';
return newString;
}
int main() {
std::cout << trim("This is a test");
return 0;
}
Thanks for your help.