Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
int wordCmp (struct lnode* n1, struct lnode* n2)
您将如何返回一个整数值,指示两个节点中的字符串之间的关系?我不太确定如何比较节点中的字符串?
我不知道您的 Inode 结构的结构,但认为它是这样的:
struct Inode { char str[20]; };
那么您可以将 wordCmp 函数编写为:
int wordCmp(struct Inode *n1, struct Inode *n2) { return strcmp(n1->str, n2->str); }
我希望这有帮助!