Added example 2-4. Program compares strings.
[C-Programming-Examples.git] / ex_2-4.c
blob89c2449711c76d6b50b58512730afea02dd606cd
1 /*
3 Delete each char in string test that matches any char in string key.
5 */
7 #include <stdio.h>
9 #define FALSE 0;
10 #define TRUE 1;
12 char key[] = "abc";
13 char test[] = "abc123";
15 int squeeze(char test[], char key[])
17 int t,k,x;
18 for(k = 0; test[k] != '\0'; k++)
20 x = TRUE;
21 for(t = 0; key[t] != '\0'; t++)
23 if(test[k] == key[t]){ x = FALSE; }
25 if(x == 1) { putchar(test[k]); }
27 printf("\n");
28 return 0;
31 int main()
33 squeeze(test, key);
34 return 0;