Here is the piece of code: I wonder where my mistake is?
I have a structure named country
, working with linked lists, and here is my function for searching:
country *search(char *v)
{
country *c; c=head;
while(c)
{
if(strcmp(c->name,v)==0)
{return c;}
c=c->next;
if(c==head) break;}
return (void *)-1;}
In main
I have (k
is a int
variable):
printf(" \n\tEnter name of country for searching: ");
fflush(stdin); gets(v);
k = search(v); // Function for searching
if(k>=0)
{puts("\n\t Info about Country: \n ");
When I compile this in Dev C++, I get:
[Warning] assignment makes integer from pointer without a cast [enabled by default]
How do I fix this problem?