예제 #1
0
bool isPalindrome(char* s) {
    char *c = s;
    while (*c != '\0') {
    	c++;
	}
    int length = c - s;
    if (length <= 0) return true;
    char *first = s, *last = c - 1;
    while (true) {
        while (*first != '\0' && !isCh(*first)) first++;
        while (!isCh(*last)) last--;
        if (first >= last)
            break;
        char a = *first;
        char b = *last;
        if (igcase(a) != igcase(b)) {
            return false;
        } else {
            first++;
            last--;
        }
    }
    return true;
}
예제 #2
0
int isAlpha(int c){
  // provjerava jeli char alfabetski
  return 1-isCh(c);
}