1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include "check_alphabet.h" #include <stddef.h> int check_alphabet(const char *str, const char *alphabet) { if (alphabet == NULL || *alphabet == '\0') { return 1; } for (int i = 0; alphabet[i]; i++) { int j; for (j = 0; str[j] && str[j] != alphabet[i]; j++) { continue; } if (str[j] == '\0') { return 0; } } return 1; }