I am using char * for getting data from the user. Now, if i just do
char * data = new char[100];
cin >> data;
The data is corrupted, i.e. only data before whitespace is stored; and the following is an example result:
enter: "Microsoft Co."
data: "Microsoft"
Can someone tell me why this thing happens?
Also, secondly, I want to avoid declaring a size to the char *, since i want the input to be flexible. Now, the following code says that the 'data' is not initailized when executed:
char * data;
cin >> data;
Any idea how to come around this?
Thanks!