Conflicting return types

Posted by Adi on Stack Overflow See other posts from Stack Overflow or by Adi
Published on 2010-03-28T05:46:14Z Indexed on 2010/03/28 6:13 UTC
Read the original article Hit count: 298

Filed under:
|

I am doing a recursive program and I am getting an error about conflicting types:

void* buddyMalloc(int req_size)
{ 
     // Do something here
     return buddy_findout(original_index,req_size); // This is the recursive call
}

void *buddy_findout(int current_index,int req_size)
{
    char *selected = NULL;

    if(front!=NULL)
    {
        if(current_index==original_index)
        {
            // Do something here
            return selected;
        }
        else
        {
            // Do Something here
            return buddy_findout(current_index+1,req_size);
        }
    }
    else
    {
        return buddy_findout(current_index-1,req_size);
    }
}

Error:

buddy.c: At top level:
buddy.c:76: error: conflicting types for ‘buddy_findout’
buddy.c:72: note: previous implicit declaration of ‘buddy_findout’ was here

Please note the file buddy.c in which I am defining this does not contain main and is linked with several other .c files.

© Stack Overflow or respective owner

Related posts about c

    Related posts about declaration