Modules in C

Modules in C

Modules in C are called functions. C programs are typically written by combining user created functions as well as “pre-packaged” functions found in the C Standard Library. For instance, printf() is a function that is found in the C Standard Library and is accessed through the stdio.h header file.
In this Unit, we are going to focus on creating our own functions. Create your own function and upload it to the forum area for discussion. Make sure that you include the correct syntax (function prototype, function call, and function definition). You can create a function that can do any kind of task. For instance, the function may display a message to the screen or compute a value. Let’s look at an example:
#include
void PrintMessage(void); //function prototype
int main (void)
{
PrintMessage(); //function call
return 0;
}
void PrintMessage(void) //function definition
{
printf(“Create your own function”):
}
This program will call the function PrintMessage in main() and display the text Create your own function to the output screen.
Remember, you are required to respond to at least two of your classmates' posts. Evaluate the functions your classmates have listed and suggest ways to incorporate more or combine methods together.
Powered by