12

C++ program crashes

view full story
linux-howto

http://www.unix.com – Hi, Can anyone tell me why the below program is crashing? and where exactly it is crashing. What is the corrective measure to be taken to make it work fine? Code: #include <iostream> #include <cstring> using namespace std; class CString {     char* m_data; public:     CString() : m_data(NULL) { }     CString(char* t) {         m_data = new char[strlen(t) + 1];         strcpy(m_data,t);     }     operator char*() {         cout << "f (HowTos)