i'm trying to write a function with header void formatline (char line ) that does the following things:
- if a comma in line is preceded by a space, it'll delete that space.
- if the colon (there will definitely be one in line) is not preceded by a space, it will insert one space before it.
(parameter line might have commas, but it will always have a colon. and there is no more than one space in between any two characters in line.)
so the function will go through line, and when it gets to a comma, it'll check if the character before it is a space, if so, it'll delete that space. and when it gets to the colon, it will check if the character before that is a space, if not it will insert one there.
my problem now is that i don't know if there's a way you can just delete an element of a character array, or insert one.. (by the way using a linked list isn't an option because this has to take in a character array).. how do i do it?
thanks in advance