Introduction to Programming Errors

In C++ programming the errors are mistakes in the programming examples that cause the program to behave unexpectedly. Most of the well versed and experienced programmers also make these kinds of mistakes in their program. Basically, Programming error is known as Bugs and the process of removing these bugs are called as Debugging.
The most common errors can be broadly classified as follows:
1. Programming Errors: These types of errors are generated when typographical errors are made by users during there program code.For example, int  5 a; here, 5 is written as accidentally which further makes our program create an error during compilation. 
2. Compiler Errors: These types of errors detected by the compiler that makes the program un-compilable. For example, Int x;
3. Linker Errors: These are errors generated when the executable of the program cannot be generated. This may be due to wrong function prototyping, incorrect header files.
4. Execution Errors: These types of errors occur at the time of execution. Looping and arithmetic errors fall under this category.
5. Logical Errors: These types of errors depend on the logical thinking of the programmer and are easy to detect if we follow the line of execution.

Programming Example to show these errors:

#include<iostream>  
#include<math.h> 
using namespace std;
int main()
{
//programming error/ typographical errors because 5 is written accidentally by programmer 
int 5 x; 
// Compile time errors because float can not be written as Float.
Float ch;
// Linker Error because for clrscr() to work we need conio.h heaher file which is not used
clrscr();
//Execution Errors, because loop can not be properly used by the programmer it go infinitely
for( int i; i<=10 )
{
// statements


}
getch(); 
return 0;
}


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: