Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- struct entry
- {
- char word[15];
- char definition[50];
- };
- bool equalStrings(const char s1[], const char s2[]);
- int lookup(const struct entry dictionary[], const char search[], const int entries);
- int main(void)
- {
- const struct entry dictionary[100] =
- {{ "aardvark", "a burrowing African mammal"},
- { "abyss", "a bottomless pit"},
- { "acumen", "mentally sharp; keen"},
- { "addle", "to become confused"},
- { "aerie", "a high nest"},
- { "affix", "to append; attach"},
- { "agar", "a jelly made from seaweed"},
- { "ahoy", "a nautical call of greeting"},
- { "aigrette", "an ornamental cluster of feathers"},
- { "ajar", "partially opened"}};
- char word[10];
- int entries = 10;
- int entry;
- printf("Enter word: ");
- scanf("%14s", word);
- entry = lookup(dictionary, word, entries);
- if(entry != -1)
- printf("%sn", dictionary[entry].definition);
- else
- printf("Sorry, the word %s is not in my dictionaryn", word);
- return 0;
- }
- bool equalStrings(const char s1[], const char s2[])
- {
- int i = 0;
- bool areEqual;
- while(s1[i] == s2[i] && s1[i] != '