I am having some trouble with some work I was assigned for my schooling. I was told to write a program that modifies a char. I can do that just fine. I just cannot get how to work with pointers. I've researched this, and found some solutions. But they don't meet the assignment's needs. I was told to define a function exactly like this:
int stripWhite(char *userInput)
So I did. The only problem is, I believe this makes a copy of the value. And does not modify the actual value. So here is some code picked out of my program:
Inside main, I declare my char, and use cin.getline to collect my input. Then I call stripwhite. Then I cout my char. The value never changes. The assignment says stripwhite needs to be defined exactly as it is above. I am at a lose here. Any help?
char userInput[100];
int spaces = 0;
cin.getline(userInput,99);
spaces = stripWhite(userInput);
cout << userInput;
int stripWhite(char *userInput)?