In C or C++, we call this modular structures as functions. We have at least one function in C or C++, the main( ). Regardless of the number of functions defined, this main function is always executed first.
What is a function?
-Schi (1992) defined this as, "the building of C in which all program activity occurs"
-It is also called as a subprogram/subroutine that performs a specific task, operation, or computation that may return or not a value.
-It is executed through a function call.
-Its general syntax is this:
function declaration is this:
Function definition is this:
#include stdio.h /*enclose this library in between <> */
/*function declaration at this line */
clrscr(); /* also a function call to clear the screen */
greet1(); /* a function call to greet1 */
greet2(); /* a function call to greet2 */
/*function defintion at this line */
printf("Welcome to modular programming!);
The expected output:
Welcome to modular programming!