📄 wordhash.main.c
字号:
/* $Id: wordhash.main.c,v 1.10 2005/03/16 03:37:13 m-a Exp $ */#include "common.h"#include "wordhash.h"typedef struct{ int count;}wh_elt_t;/* function definitions */static void word_init(void *vw){ wh_elt_t *w = vw; w->count = 0; }static voiddump_hash (wordhash_t * h){ hashnode_t *p; for (p = wordhash_first (h); p != NULL; p = wordhash_next (h)) { word_t *key = p->key; (void)word_puts(key, 0, stdout); (void)printf (" %d\n", ((wh_elt_t *) p->buf)->count); }}intmain (void){ wordhash_t *h = wordhash_new (); char buf[100]; wh_elt_t *w; while (scanf ("%99s", buf) != EOF) { word_t *t = word_news(buf); w = wordhash_insert (h, t, sizeof (word_t), &word_init); w->count++; } dump_hash (h); wordhash_free (h); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -