/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that decides if the character 
   is in the alphabet */
#include <stdio.h>
#include <stdlib.h>

int main() {
    char *alpha="abcdefghijklmnopqrstuvwxyz";
    char ch, *p;
    int comp();

    ch='m';
    p=(char *) bsearch(&ch,alpha,26,1,comp);
    if(p) 
        printf("%c is in alphabet\n", ch);
    else
        printf("%c is not in alphabet\n", ch);
}

/* compare two characters */
int comp(char *ch, char *s)
{
    return (*ch)-(*s);
}
