Section 1: Functions
All of the instructions performed in a C program are contained in functions.
image showing structure of C functions

When a statement in a line of code tells the program to perform the instructions defined in a particular function, this is referred to as "invoking" or "calling" the function. A standard C program always includes a special function called "main()", and program execution starts with the first line of that function. As you will see below, functions often include calls to other functions.

The syntax of a C function is essentially the same as is used in Java, Processing, JavaScript and a host of other programming languages, so once you learn it, you can read and write functions in a bunch of other procedual programming environments.

The following code does one simple thing: it takes a number and adds 1 to it, a process called "incrementing" (adding one to something.) This process happens in a function called incrementer(), a custom function defined after the main() function:
/* ------ incrementer.c ------
   (Adds one to a given number.)
------------------------------ */
#include <stdio.h>

void main(){
   printf("This program calls an 'incrementer function' ");
   printf("on the number 7.\n");

   int num = incrementer(7);   // Call incrementer
            // and store its return value in "num"

   printf("The incremented value is: %d", num);
   printf("\n");   // Print a new line
}

int incrementer(int num_to_increment) {
   num_to_increment = num_to_increment + 1;
   return num_to_increment; // Returns the number's new value
}
Ok.
Now, let's add some interactivity.
In this example, we change a couple of things so when the program runs, it asks the user to enter a number to increment:
/* ------ incrementerEnter.c ------
(Adds one to an entered number.)
----------------------------------- */
#include <stdio.h>
int getNum;

void main(){
   printf("Enter the number to increment: ");
   scanf("%d", &getNum);

   int num = incrementer(getNum);   // Call incrementer
    // with the entered number, store its result in "num"

   printf("The incremented value is: %d", num);
   printf("\n \n");   // Print a blank line
}

int incrementer(int num_to_increment) {
   num_to_increment = num_to_increment + 1;
   return num_to_increment; // Returns the number's new value
}