| C语言库函数(B类字母) |
|
| 作者:未知 文章来源:网络收集 点击数: 更新时间:2006-3-29 15:22:23
|
>while(!kbhit()) { bios_time = biostime(0, 0L);
gotoxy(50, 1); cprintf("%lu", bios_time);
gotoxy(50, 2); cprintf("%.4f", bios_time / CLK_TCK);
gotoxy(50, 3); cprintf("%.4f", bios_time / CLK_TCK / 60);
gotoxy(50, 4); cprintf("%.4f", bios_time / CLK_TCK / 3600); } return 0; }
函数名: brk 功 能: 改变数据段空间分配 用 法: int brk(void *endds); 程序例:
#include #include
int main(void) { char *ptr;
printf("Changing allocation with brk()\n"); ptr = malloc(1); printf("Before brk() call: %lu bytes free\n", coreleft()); brk(ptr+1000); printf(" After brk() call: %lu bytes free\n", coreleft()); return 0; }
函数名: bsearch 功 能: 二分法搜索 用 法: void *bsearch(const void *key, const void *base, size_t *nelem, size_t width, int(*fcmp)(const void *, const *)); 程序例:
#include #include
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
int numarray[] = {123, 145, 512, 627, 800, 933};
int numeric (const int *p1, const int *p2) { return(*p1 - *p2); }
int lookup(int key) { int *itemptr;
/* The cast of (int(*)(const void *,const void*)) is needed to avoid a type mismatch error at compile time */ itemptr = bsearch (&key, numarray, NELEMS(numarray), sizeof(int), (int(*)(const void *,const void *))numeric); return (itemptr != NULL); }
int main(void) { if (lookup(512)) printf("512 is in the table.\n"); else printf("512 isn't in the table.\n");
return 0; }
中华技术网整理发布 screen.width-600)this.style.width=screen.width-600;">_blank href=http://www.asfocus.com>上一页 [1] [2] [3] [4] [5] [6] 下一页
|
|
[ 收藏此页到: 天天|和讯|博采|ViVi|狐摘|我摘|天极 ] 文章录入:kinda 责任编辑:kinda |
|
上一篇文章: C语言库函数(A类字母) 下一篇文章: C语言库函数(C类字母) |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |