Hi, i was hoping for some help, opposed to full solutions and i have an idea that i need to know what i am doing wrong when trying to implement
basically i am trying to remove spaces from the end of an array of characters in c
this is what i am doing
i have a method to work out the length of the string and store it in to an int
i set a pointer to point at the first element of my character array
i then set the pointer to the length of the string - 1 (as to not go past the array index of n-1)
if the element here is not a space then i no there are no spaces at the end so i just return the element as a whole
this is where i am stuck, now in the else i no that it must have been a space character ' ' at the end right? without using a library function, how on earth do i remove this space from the string, and proceed with a loop until i meet a character that’s not a ' ' . the looping bit until i meet a character that is not a ' '(space) is easy - its just the removing that’s proving a beast :D
thanks guys - please no solutions though, this is homework and i don’t want to cheat regards
sam