Skip to content
Snippets Groups Projects
Commit aa924597 authored by Hiba L Moudden's avatar Hiba L Moudden
Browse files

ajout de eq dans list.c

parent 3dfb7c14
No related branches found
No related tags found
No related merge requests found
#include<stdlib.h>
struct node_t {
unsigned long int key;
void* val;
......
......@@ -60,15 +60,16 @@ void list_destroy(list_t l, void (*free_void)(void*)){
// return the found element or NULL
//recherche l'element x
void* list_in(list_t l, void* x, int (*eq)(void*, void*)){
if(list_is_empty(l))
return NULL;
while(!list_is_empty(l)){
if(l->val == x)
if((eq) (l->val, x))
return l;
l=l->next;
}
return NULL;
}
//
unsigned long int list_len(list_t l){
if(list_is_empty(l))
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment