I was implementing linked list in C program worked but gave the following warnings in terminal
linkedstr.c:36:11: warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
link *search_link() , *pred_link();
^
linkedstr.c:36:28: warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
link *search_link() , *pred_link();
here is the code of the following functions
link *search_link(link *l, int x)
{
if (l == NULL)
return NULL; //end of list is reached
if (l->val == x)
return l;
else
return (search_link(l->next, x)); //search sub_list
}
link *pred_link(link *l, int x)
{
if (l == NULL || l->next == NULL)
return (NULL);
if ((l->next)->val == x)
return (l);
else
return (pred_link(l->next, x));
}
I googled and there was an explanation link] but it says that we can't leave parameters empty and we foo(void) must be passed instead of foo() but I clearly gave the parameters in my functions so why the warnings?