While writing large programs, a programmer usually makes many mistakes. Due to this, bugs occur even in the released softwares. Developing an error-free program is the only objective and intention of the programmer. Programmers should take care to prevent errors. Errors can be trapped using exception-handling features.
A few languages support exception-handling features. Without this feature, the programmers should find out errors on their own. The errors may be logical errors or syntactic mistakes (syntax mistakes). The logical error remains in the program due to a poor understanding of the program. The syntax mistakes made are due to a lack of understanding of the programming language. C++ provides an exception-handling procedure to reduce the errors that the programmer makes.
The programmer always faces unusual errors while writing programs. An exception is an abnormal termination of the program, which is executed in a program at run time or it may be called at run time when the error occurs. The exception contains warning messages such as invalid argument, insufficient memory, and division by zero. ANSI C++ is built in language functions for trapping errors and controlling exceptions. All C++ compilers support this newly added facility.