Summary of the C Language
General form of a C program
/*
multi-line comments */
//
single-line comments
#include <
filename>
- Include a "header" file from a "system" directory, e.g. for any
standard libraries used.
#include "
filename"
- Include a "header" file from a "local" directory, e.g. for
definitions which are global to a project.
#define
label
value
- Define literal constants; the compiler will replace every occurence
of label in the source code with the text specified by
value.
- global variable declarations
- These variables are accessible by all functions in the file, and are
also "public" (and hence accessible from any other file in the program) unless
declared with the
static
attribute.
int main()
{
- the first function called when the program executes; returning from
it returns to the operating system.
statement;
|
statement;
}
- return-type
function-name(
parameter variable declarations)
{
- local variable declarations
statement;
|
statement;
}
Constants
Variables
Statements
Functions
Expressions
Operators