11

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.

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
user15873596
  • 155
  • 1
  • 9

1 Answers1

13

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

void viderBuffer( void );

And define it also like

void viderBuffer( void )
{
    //...
}
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
  • 2
    Actually, adding `void` in the parentheses helps me eliminate the warning. Thanks anyway. – wzso May 20 '21 at 07:40