Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent error : this old-style function

I am following a tutorial and my code seems normal but I got a message which says

This old-style function definition is not preceded by a prototype

code.c :

void viderBuffer()
{
    int c = 0;
    while (c != '\n' && c != EOF)
    {
        c = getchar();
    }
}

Thanks you for your help. Sorry if my post is not perfect I am new here.

like image 903
user15873596 Avatar asked May 11 '21 08:05

user15873596


1 Answers

Declare the function before main (or before referencing it in main) like

void viderBuffer( void );

And define it also like

void viderBuffer( void )
{
    //...
}
like image 198
Vlad from Moscow Avatar answered Sep 23 '22 01:09

Vlad from Moscow