I am not able to figure out the code required for accepting a string from user , but the memory for it should be dynamically allocated and referenced using pointer.
Have a look at the following:
char *p=new char[length_of_string+1];
This statement would work to dynamically allocate the string ,but still I require the length and that depends on user's input.
Is there a better way to handle this situation? Please help!!!