C ++ language elements

C ++ language elements

Elements of the C + language + to:

• identifiers,
• numbers,
• Subtitles,
• signs,
• Keywords,
• reserved words,
• limiters,
• comments.


An identifier is any string of letters or numbers starting with a letter. May contain the underscore character (_). It cannot contain the space sign or Polish letters. The maximum length of the identifier determines the number of characters distinguished and is dependent on the development environment. Identifiers with longer names are indistinguishable.

C + + distinguishes between lowercase and uppercase letters in identifiers.

Identifiers represent the names of program elements such as e.g.. Constant, variables and functions.

Examples of identifiers:

A1 a1
bok pole dlugosc szerokosc
Nazwa_Towaru NazwaTowaru nazwaTowaru

It is recommended to use names that define the meaning of the object.

Each identifier has a specific scope, in which it is visible and can be used. Some identifiers work within the file, and another block (from the place of declaration to the end of the block), in which the declaration occurred.


A string of numbers, which may be preceded by characters + the . In real numbers, the math comma has been replaced with a dot. Real numbers come in two forms:

• as fixed point numbers, np. 5.7 -3.4 .5 23.45,

• as floating point numbers with the format: guy, i.e.. in the form of a mantissa separated by the letter E from the c, np.: 1.5E2.

Numbers may appear directly in the program text as explicit - unnamed constants. They can be written in decimal code, np. 35, in octal it 043 and in hexadecimal it is 0x23


The string is a string of any characters (also Polish) placed between two quotation marks:

” Data error ”
” Please enter your last name ”

C + subtitles + end with a sign \0, which is added automatically.

There may be special characters preceded by a sign in the string \.

Sign \n in the inscription, np.:

” N Data error ”
“\n Enter the last name ”

causes the line to change before the string is output to the screen.

Special characters used in strings include:

\n - new line
\b - move the cursor one character back
\a - bell
\’ - apostrophe
\t - horizontal tab
\r - carriage return
\\ - backslash
\” - quote
\v - vertical tab
\f - new page
\? - question mark
\0 - zero mark


The single character used in the program is enclosed in single quotes, np. ‘A.

Key word

The keyword is the word of the English language (written in lowercase) with a fixed meaning in a programming language used in instructions. Keywords cannot be redefined. The pattern language C keyword set includes: auto, break, case, char, const, continue, default, define, into, double, else, enum, external, float, for, goto, huge, if, inline, int, interrupt, long, near, main, register, return, short, signed, sizeof, static,struct,switch,typedef, union,unsigned,void,volatile,while.

For C. + + this word set has been extended to include the following additional words:

asm, class, delete,friend,inline,new,operator,private, protected,public, template,this, virtual.

In the texts of these programs, keywords will be indicated in bold.

A reserved word

A reserved word is the highlighted word of the English language (such written in lowercase) with a specific meaning, assigned to some object (constant, variable, funkcji) defined in language libraries. Reserved words may be redefined. Examples of reserved words:

atoi, atof, abs, ceil, cos, delay, feof, fclose, fflush, floor, fopen, fprintf, fread, fseek, fwrite, getch, gets, key, khbit, printf, read, reset, rename, scanf, write…

Various implementations of the C language + + they extend this collection with new names in connection with the expansion of the language with new elements.


A delimiter is a character that ends a lexical symbol of a language that also has a specific meaning and purpose. The primary delimiter is a space. They are limiters too: arithmetic operators: Relational operators: logical operators: parentheses symbols: punctuation marks: special symbols:


Explains program code and is skipped during compilation.

A line commentary

It is placed on the line after the characters // and is valid until the end of the respective program line:

//this is a line comment

Block comment

A block comment can be divided into lines and is placed between characters /* i */:

/* this is a block comment

Leave a Reply

Your email address will not be published. Required fields are marked *