I am trying to compare a char[100] (nodo->fname) with char* (name) in C and i am geting a segmentation fault in the strcmp function when comparing both:
struct mmap_info{
char fname[100];
}
pos search_mmap(list *l, char *name){
for(pos p = first(*l); !end(*l, p); p = next(*l, p)){
struct mmap_info *nodo = get(*l, p);
if(strcmp(nodo->fname, name) == 0){
return p;
}
}
return NULL;
}
(Already malloc() nodo in other part of the code)
Is this the way I should compare them? If not how should I? Thank you!