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 20:55 ID:Heaven

#include <stdio.h>

void remove_char_from_string(char *string,char char_to_remove){
 int i,j=0,l=strlen(string);
 char s2[l];
 for(i=0;i<l;++i)if(!(string[i]==char_to_remove))s2[j++]=string[i];
 s2[j]=0;
 memcpy(string,s2,l);
}

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