Tuesday, 15 May 2012

C error: "conflicting types for" -



C error: "conflicting types for" -

my programme includes next code:

static short index(key) unsigned char *key; { long i, sum = 0; (i = 0; key[i]; i++) sum += key[i]; return(sum % table_size); }

but, gives next error:

table.c:46:14: error: conflicting types 'index' static short index(key) ^

i'm c newbie, read prototyping etc., cannot solve problem.

index function in c library. if take different name function, error go away.

from man page, see takes const char* , int.

#include <strings.h> char *index(const char *s, int c);

c types

No comments:

Post a Comment