// archives

C++ Glossary

This category contains 24 posts

Enumeration Types

An enumeration type

Is a type whose values are defined by a list of constants of type int
An enumeration type is very much like a list of declared constants
Enumeration types can be handy for defining a list of identifiers to use the case labels in a switch statement

When defining an enumeration type

You can use any int [...]

Difference Between Pre Increment Operator and Post Increment Operator

++n

Is called a pre-increment operator because the operator appears to the left of its operand
The pre-increment operator changes the value stored in memory first and then uses the new value in the remainder of the compound statement
Here is an example (A-1):

n++

Is called a post-increment operator because the operator appears to the right of its operand
The [...]

return 0;

return 0;

The program ends when the following statement is executed (A-1)
The statement ends the invocation of the function main and returns 0 as the function’s value
According to the ANSI/ISO C++ standard, this statement is not required, but many compilers still require it

Example of (A-1)

return 0;

int main()

int main()

The following line says that main is a function with no parameters that returns an int (integer) value (A-1):
Some compiler will allow you to omit the int or replace it with void, which indicates a function that does not return a value. However, it is the most universally accepted way to start the main [...]