Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Recursive Character Search and Destroy

Name: Anonymous 2007-05-11 16:50 ID:tCgeez6Q

I receive a string, and I want to remove any 'a', 'b' and 'c' characters, in a recursive way.

How do I do this in C and Java?

Thanks

Name: Anonymous 2007-05-11 18:28 ID:Heaven

THE PROPER WAY TO DO IT IN C (I.E., NO PUSSY RECURSION SHIT):

#include <string.h>

void removeChar(char *s, char c) {
    int charShift = 0, i, len = strlen(s)+1;

    for (i = 0; i < len; i++) {
        s[i-charShift] = s[i];
        if (s[i] == c)
            charShift++;
    }
}


NOW KILL YOURSELF, FOR THE GOOD OF PROGRAMMERS EVERYWHERE.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List