This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.

Monday 26 August 2013

Common Errors and Steps to Rectify these errors while compiling C and C++ Programs


S.No.
Common Errors
Rectification
1.
Statement missing ;
‘;’ should be placed at the end of the statement.
2.
Undefined symbol/variable.
Declaration of the data type should be done for the variable.
3.
Function ‘clrscr’ / ‘cin’ / ‘cout’ should have prototype.
#include< .h> à header file must be included.
4.
Unknown preprocessor directive.
Uppercase ‘I’ in include should be changed to lowercase ‘i’.
5.
Illegal structure operation.
cin must have >> and cout must have <<
6.
Parameters names are used only with a function body.
[ ] must be used to declare an array and not ( ).
7.
Declaration missing.
Variable must be declared.
8.
L value required.
Proper relational operator must be used (eg == should be used and not = )
9.
Misplaced else.
In ‘if statement’ the action block must be enclosed in { }
10.
Invalid syntax.
‘;’ should not be placed after the condition in if statement / for statement / while / do…while statements.
11.
Switch selection expression must be of integer type.
Switch expression should be evaluated to an integer constant only (char, int).

1 comment: