The following code prints the expected output within the for loop , but once I exit the loop , it only prints "Here" , with nothing underneath it. What am I missing here?
char ** strs = new char*[n]; for (int i = 0; i < n; i++) { string str; getline(cin, str); strs[i] = const_cast<char*>(str.c_str()); cout << strs[i] << endl; } cout <<"here" <<strs[1] << endl;