Function declaration and definition
int main(void) {
printf("Hello World!");
return 0;
}
The function consists of two parts
void myFunction() { // declaration declaration
// function body (code to be executed) (definition)
}
Declaration
declares the function name, return type and parameters (if any)
* Definition
function body (code to execute)
// function declaration
void myFunction();
// main method
int main() {
myFunction(); // --> call the function
return 0;
}
void myFunction() {// Function definition
printf("Good evening!");
}
Comments