I'm new to C and have started learning about strings. I want to create a function called
void SpaceRemover(char *name)
Say If there is more than one space character in a row anywhere in the string I want to collapse this so that just a single space character remains...
For the string input name[200] = "david smith"
If I call my function:
SpaceRemover(name)
printf("Name = [%s]\n", name);
I should get Name = [david smith]
The code that I've produced so far removes all the spaces and doesn't provide the output I'm looking for. Can anyone help me with this?
Aucun commentaire:
Enregistrer un commentaire