Using (Microsoft Visual Studio C++ 6.0) software, follow the sample output to write and run a program that reads one line of text and then uses a function called remove which will remove the blank spaces between the text for and then print.
The function prototype is as follow:
voidremove(char *s);
Sample Output:
Enter a line of text:
Your FUTURE is created by what you do TODAY not TOMORROW.
The text after removing the blank spaces is:
YourFUTUREiscreatedbywhatyoudoTODAYnotTOMORROW.
s is a char* (pointer to char) and that is the type that the remove function expects. &s gives you a char** (pointer to pointer to char) and that is not what you want.
remove(&s);
Another problem is that s does not yet point to anything. You need to make sure it points to some memory so that getline has somewhere to store the string.
You have two errors here:
1. remove() takes a pointer, and 's' is a pointer. Address of a pointer is wrong type.
2. Even if you would pass the 's' correctly, you never did initialize that pointer.
MSVC6 was released 1998. Last millenium. It is ancient. Deprecated.
The "right code" does not benefit you in any way if you don't understand it.
You say that there are errors, but you don't show what they are. Learning to read error messages is useful, psychic ability to know the untold is rare.