Structure of C Programs

Objectives

Having completed this section you should know about: C's character set C's keywords the general structure of a C program that all C statement must end in a ; that C is a free format language all C programs us header files that contain standard library functions.

C's Character Set

C does not use, nor requires the use of, every character found on a modern computer keyboard. The only characters required by the C Programming Language are as follows:

A - Z

a -z

0 - 9

space . , : ; ' $ "

# % & ! _ {} [] () < > |

+ - / * =

The use of most of this set of characters will be discussed throughout the course.

The form of a C Program

All C programs will consist of at least one function, but it is usual to write a C program that comprises several functions. The only function that has to be present is the function called main. For more advanced programs the main function will act as a controlling function calling other functions in their turn to do the dirty work! The main function is the first function that is called when your program executes.

C makes use of only 32 keywords which combine with the formal syntax to the form the C programming language. Note that all keywords are written in lower case - C, like UNIX, uses upper and lowercase text to mean different things. If you are not sure what to use then always use lowercase text in writing your C programs. A keyword may not be used for any other purposes.