chinmay.sahoo
New member
In C++, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one logical entity.
As you know, a block is a set of logically connected statements that are surrounded by opening and closing braces. A block is not terminated with a semicolon. Since a block is a group of statements, with a semicolon after each statement, it makes sense that a block is not terminated by a semicolon; instead, the end of the block is indicated by the closing brace. This is also the reason that there is no semicolon following the closing brace of a function.
C++ does not recognize the end of the line as a terminator. For this reason, it does not matter where on a line you put a statement. For example,
As you know, a block is a set of logically connected statements that are surrounded by opening and closing braces. A block is not terminated with a semicolon. Since a block is a group of statements, with a semicolon after each statement, it makes sense that a block is not terminated by a semicolon; instead, the end of the block is indicated by the closing brace. This is also the reason that there is no semicolon following the closing brace of a function.
C++ does not recognize the end of the line as a terminator. For this reason, it does not matter where on a line you put a statement. For example,
Code:
x = y;
y = y+1;
mul(x, y);
is the same as
x = y; y = y+1; mul(x, y);
to a C++ compiler.