⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spell.c

📁 掌握如何用C来实现各种算法
💻 C
字号:
/*****************************************************************************
*                                                                            *
*  -------------------------------- spell.c -------------------------------  *
*                                                                            *
*****************************************************************************/

#include <string.h>

#include "search.h"
#include "spell.h"

/*****************************************************************************
*                                                                            *
*  ------------------------------ compare_str -----------------------------  *
*                                                                            *
*****************************************************************************/

static int compare_str(const void *str1, const void *str2) {

int                retval;

if ((retval = strcmp((const char *)str1, (const char *)str2)) > 0)
   return 1;
else if (retval < 0)
   return -1;
else
   return 0;

}

/*****************************************************************************
*                                                                            *
*  --------------------------------- spell --------------------------------  *
*                                                                            *
*****************************************************************************/

int spell(char (*dictionary)[SPELL_SIZE], int size, const char *word) {

/*****************************************************************************
*                                                                            *
*  Look up the word.                                                         *
*                                                                            *
*****************************************************************************/

if (bisearch(dictionary, word, size, SPELL_SIZE, compare_str) >= 0)
   return 1;
else
   return 0; 

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -