C ++ program elements
declarations, definitions, instructions.
Declarations and definitions
The declaration assigns a name (ID) a specific object, np. constant, variable or function. Object name declarations use the names of standard numeric types and the names of programmer-defined types.
The definition allocates memory to variables and constants, and in the case of functions, it describes their behavior. The variable declaration is most often its definition (except for variables preceded by a word external exported by the module).
A constant declaration of a standard integer type int:
const dimension = 100;
Variable declaration of the standard integer type int:
The declaration may contain a list of variables of the same type. Some variables may be initialized together with the declaration.:
int i ,j,k;
Function declaration square calculating the field:
you are square(int);
The declaration of a function requires its definition.
The statement specifies the operation to be performed on the arguments. C ++ statements are divided into simple and structured.
Simple statements perform one action. They are:
• instruction (operator) assignments,
• function call,
• unconditional transition - jump to another part of the program.
Structured instructions are made up of many instructions, both simple, and structural. Structural instructions are as follows:
Each statement ends with a semicolon - ;, which is the sequence operator. It causes, that the next statement will not be executed until the previous one has finished.
The instructions are executed in the order they are written in the program. The order in which the statements are executed can be changed by the control statements, i.e.. conditional statement, iterative statements, selection instruction, a jump instruction and a function call.