I have this code:
Compiling using 'g++ test.cpp'Code:#include <string> #include <iostream> using namespace std; void main() { char* sztest = "hello"; char* retVal = ""; retVal = strcat(retVal,sztest); cout << retVal << endl; }
I run it and get segmentation fault that comes from the strcat.
Now whats wrong with this code?





Reply With Quote