#include<stdio.h> typedef struct ode { int value; struct Node *link; }Node; /*Call back function, it's useful for different kind of node, we just want to change compare function*/ Node* getnode(Node *ele,void const *val, int (*compare)(void const*, void const *)) { while(ele!=NULL) { if(compare(&(ele->value),val)) break; ele=ele->link; } return ele; } int com_int(void const *a,void const *b) { if(*(int *)a==*(int *)b) return 0; else return 1; } int main() { Node root; Node one; int target=90; one.value=90; one.link=NULL; root.value=35; root.link=&one; Node* tmp=getnode(&root,&target,com_int); if(tmp!=NULL) { printf("%d",tmp->value); } return 0; }