[beginner to programming] look at C Primer Plus, there is a small problem when you see the definition of the function at the beginning. It feels like the function has a duplicate definition.

I haven"t taught myself programming for long, and the problems I encounter are relatively primary. I hope all of you who pass by will give me a lot of advice, don"t spray ha if you don"t like it. The
code is as follows:

/**/
-sharpinclude <stdio.h>
void butler (void);  /* ISO/ANSI C*/
int main (void)
{
    printf("I will summon the butler function.\n");
    butler();
    printf("Yes. Bring me some tea and writeable CD-ROMS.\n");
    return 0;
}

void butler (void) /*      */
{
    printf("You rang, sir?\n")
}

my question is:

clipboard.png

void butler (void);  /* ISO/ANSI C*/

what exactly does this line of code do? I"ve learned a little bit about JAVA and python before, and I don"t remember anything like this

.
C
May.16,2022

C language requires functions declare and then define before calling

void butler (void); / * ISO/ANSI C function prototype * / this is a declaration telling the compiler that I need to use this function

  

the former is the declaration , and the latter is the definition . The
declaration tells the compiler that there is something that, by definition, tells the compiler what it looks like.

Menu