#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
char *dic[][40] = {
"A", "AA",
"B", "BB",
"C", "CC",
"D", "DD",
"", "" /* null terminate the list */
};
char word[80]="A", ch;
char **p;
p = (char **)dic;
do {
if(!strcmp(*p, word)) {
puts(" is ");
puts(*(p+1));
break;
}
if(!strcmp(*p, word)) {
break;
}
p = p + 2;
} while(*p);
if(!*p){
puts("Word not in dictionary.");
}
return 0;
}
|