Function re-declaration

int foo(int x, int y);
void char(int x, int y); // not allowed as showed in the example....
int foo (int x, int y);  // is this allowed?? I guess not... functiondef can only be defined once??
int main(){
  ...
}

A function (like a global variable) can be declared as often as you want, as long as all declarations have the same type.

There may only be (at most) one definition of a function. If there are two, that is a type error.

Note that the order does not matter. In particular, you can have a declaration, a definition, and then another declaration, and this is still fine.

You are not allowed to declare functions inside of a block. Such code is syntactically invalid and not produced by the parser.

1 Like

okay, i see, thanks :+1: