Semicolons & Blocks in C++:
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.
For example, following are three different statements:
x = y; y = y+1; add(x, y);
A block is a set of logically connected statements that are surrounded by opening and closing braces. For example:
{ cout << "Hello World"; // prints Hello World return 0; }
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:
x = y; y = y+1; add(x, y);
is the same as
x = y; y = y+1; add(x, y);
C++ Identifiers:
A C++ identifier is a name used to identify a variable, function, class, module, or any other user-defined item. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9).
C++ does not allow punctuation characters such as @, $, and % within identifiers. C++ is a case-sensitive programming language. Thus, Manpower and manpower are two different identifiers in C++.
Here are some examples of acceptable identifiers:
No comments:
Post a Comment