[previous_group] [previous] [up] [next] [next_group]

What is a Function?

A function is a list of statements and local storage, which when given some "information", does some processing and returns a value.

Recall the source code we had for the very simple hello program. There are three functions here:

main() -
this is a special function which every C program must have. It is the function that is started when the program is executed.
func1() -
this is the function I wrote to print the goodbye message. In this case, nothing needs to be given to it, and it has no useful information to return.
printf() -
this is a "built-in" function; part of the C library. It is given the information we want to appear on the screen, and it handles all the details of getting it printed.

After this source code is compiled, what happens when it is run?

Statements:
are the "sentences" of the C language. We will see the kinds of statements we can use in C, together with their "syntax" (grammar), and "semantics" (meaning), as we go through the course.

[up] to Overview.

[next]