Problem | Type | Comments |
Undeclared | Compiler Error |
Variable not
declared, examples of declarations: int a; float b; double c; char d; boolean e; |
Unreferenced | Compiler Warning |
Variable not used
in the code, examples of use: x = y + z; // x, y and z are now referenced |
Uninitialized | Runtime Error |
Variable not given a specific value before it is used in a RHS (right hand side) expression. Variables can be initialized in 3 ways:
|
Pseudo-code |
In C/C++/Java: | ||
Flow
chart |
General syntax:
|
Code |
Flow
chart |
|
|
|
|
Pseudo-code |
Output |
Tracing the code,
|
Without comments: |
|||||||||||||||||||||
|
4 |
|
|
With comments |
Pseudo-code |
Equivalent C++ code |
|
|
|