词条 | lfind |
释义 | 函数名: lfind 功 能: 执行线性搜索 用 法: void *lfind(void *key, void *base, int *nelem, int width, int (*fcmp)(const void *, const void *)); 程序例: #include <stdlib.h> #include <stdio.h> int compare(int *x, int *y) { return( *x - *y ); } int main(void) { int array[5] = {35, 87, 46, 99, 12}; size_t nelem = 5; int key; int *result; key = 99; result = lfind(&key, array, &nelem, sizeof(int), (int(*)(const void *,const void *))compare); if (result) printf("Number %d found\",key); else printf("Number %d not found\",key); return 0; } |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。