気になるところがいくつか

cellptr の typedef はまとめて

typedef struct cell {
char *word;
int count;
struct cell *next;
} cell, *cellptr;

でいいと思う

だけど

struct cell *q, *r;

としてるのが不明

せっかくだから

struct cellptr q, r;

という使い方しないの?