Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void remove_array(void *list,int index,int len){
- int i;
- if(index == 0){
- for(i = 0; i < len; i++)
- list[i]=list[i+1];
- list[strlen(list)-1]='\0';
- }
- if(index == strlen(list)-1) list[strlen(list)-1]='\0';
- if(index > 0 && index < strlen(list)-1){
- for(i = index; i < strlen(list)-1; i++)
- list[i]=list[i+1];
- list[strlen(list)-1]='\0';
- }
- }
- void remove_string(char *s,char *param){
- int i,j;
- for(i = 0 ; i < strlen(s); i++)
- for(j = 0; j < strlen(param); j++)
- if(s[i] == param[j]){
- remove_array((char *)s,i,strlen(s));
- i--;
- }
- }
- int main(){
- char str[]="11A42BCA31?H%O^A$NG!";
- char key[]="0123456789 ?%^$!";
- remove_string(str,key);
- printf("s= %s",str);
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment