I was hoping for some help, against complete solutions, and I have an idea that I need to know what I'm doing wrong when I try to implement.
I'm basically trying to remove spaces from the end of a character array in C.
I have a way to work out the length of a string and store it in int.
I set the pointer to the first element of my character array.
Then I set the pointer to the length of the string - 1 (so as not to get past the index of the array n-1).
If the element is not a space here, then I know that there are no spaces at the end, so I just return the element as a whole.
That's where I am stuck, now in a different one, I know that it should have been a run symbol ' 'at the end on the right? Without using the library function, how do I remove this space from the string and continue the loop until I meet a character that is not ' '? A bit bit until I come across a character that is not ' '(space) is simple - it's just a deletion that proves the beast.
Please, not complete solutions, because this is homework, and I do not want to deceive.
source
share