First, tell us what you mean by it goes crazy? (I think I know, but you need to clarify the problem.)
Your function should not be doing input or output. Use getline( ) in main(), and pass the string to the function. Keep in mind the job of a function should be limited, ideally to a single task.
Is it necessary for you to place the NULL terminator at the end of the string array in your function after getting the input? Should you ever have to place the NULL after using getline()?
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228