c - Why Does Clang See a Type Conflict? -
resolved!
maybe i'm losing edge, me don't see why clang giving me following error when compile linked list file (llist).
error: conflicting types 'remove' int remove(struct node *llist, int val); note: previous declaration here extern int remove(const char *__filename) __throw;
my .h file:
struct node{ int val; struct node *left, *right; }; struct node* get(struct node *llist, int i); int remove(struct node *llist, int val); struct node* search(int val, struct node *llist); void deletelist(struct node *llist); void add(struct node *llist, struct node *toadd);
my .c file:
#include <stdio.h> #include <stdlib.h> #include "llist.h" int remove(struct node *llist, int val){ struct node *cur = llist->right; while(cur != llist){ if(cur->val != val) cur = cur->right; else{ cur->left->right = cur->right; cur->right->left = cur->left; free(cur); return 1; } } return 0; }
there standard function named remove
in stdio.h
has signature of:
int remove(const char *filename);
rename function.
note: @r.. points out, name remove
reserved if stdio.h
not included.
Comments
Post a Comment