compiler construction - Syntax error : missing ';' before 'type' C code -


yes, has been asked before , have followed advice here , put declerations @ top still not working.

void map_delete(map_t *map, char *key) {    assert(map_contains(map, key));     map_elem_t *prev;    map_elem_t *elem_to_remove;     prev = map->elem;    while(strcmp(prev->next->key, key) != 0) prev= prev->next;     elem_to_remove = prev->next;    prev->next = elem_to_remove->next;    free(elem_to_remove); }   map.c(74): error c2143: syntax error : missing ';' before 'type' map.c(76): error c2065: 'prev' : undeclared identifier map.c(76): warning c4047: '=' : 'int' differs in levels of indirection 'map_elem_t *' map.c(77): error c2065: 'prev' : undeclared identifier map.c(77): error c2223: left of '->next' must point struct/union map.c(77): error c2198: 'strcmp' : few arguments call map.c(77): error c2065: 'prev' : undeclared identifier map.c(77): error c2065: 'prev' : undeclared identifier map.c(77): error c2223: left of '->next' must point struct/union map.c(79): error c2065: 'elem_to_remove' : undeclared identifier map.c(79): error c2065: 'prev' : undeclared identifier map.c(79): error c2223: left of '->next' must point struct/union map.c(80): error c2065: 'prev' : undeclared identifier map.c(80): error c2223: left of '->next' must point struct/union map.c(80): error c2065: 'elem_to_remove' : undeclared identifier map.c(80): error c2223: left of '->next' must point struct/union map.c(81): error c2065: 'elem_to_remove' : undeclared identifier map.c(81): warning c4022: 'free' : pointer mismatch actual parameter 1 

note logic of code correct working on machine, compiler not happy layout

the compiler complains because assert not declaration. you'll need move assert comes after declarations.

using c compiler supported standard more recent c89 move.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -