#define is a preprocessor directive, it does not declare nor define functions.
This is how you declare and define a function:
-
void myfunction(); // declaration
-
-
int main()
-
{
-
myfunciton(); // use function
-
return 0;
-
}
-
-
void myfunction() { // definition
-
}
-
If you omit the declaration, then you will probably get a "conflicting types" warning since the compiler declared it for you and may use a different prototype than what you use in your definition. You are allowed to omit the declaration if you put the definition where the declaration is - before any calls to the function.
If you omit the definition you'll get an linker error unless its defined in another .c/.cpp file which you compile at the same time.
If you use #define to "define" your function then you will have unintentionally defined a preprocessor macro not a function and monkeys will fly out your ears.
One more thing: C++ (not C) supports function overloading so if your function is defined to take three arguments for example and you try to call it with two, then the compiler will look for an overloaded version of the function which takes two arguments. When it doesn't find it, it will implicitly declare it.