A function is just a named block of code. Write it once and call it from many places, which cuts down on repeated code and makes the project easier to maintain.
c
#include <stdio.h>
void showWelcome() {
printf("Welcome to C functions!
");
}
int main() {
showWelcome();
showWelcome();
return 0;
}void means the function doesn't return a value. showWelcome() runs the code inside the function every time it's called.
You should see
Welcome to C functions! Welcome to C functions!Info
Naming a function as an action makes it easier to read. For example, calculateTotal, printMenu, validateInput.