|Errors in C++ | Types of errors by @ameen12

in hive-181430 •  4 years ago  (edited)

Hello dear community members!
I hope you will fine. Actually C++ has some basic errors which we have to face.

Errors
Software errors are prevalent. It’s easy to make them, and it’s hard to find them. Errors in a program are "bugs" and finding & removing these errors is debugging. Debugging means removing of bugs.

error-63628__480.jpg

Types of errors

There are three types of error
•Syntax error
•Logical
•Runtime error

Syntax error
Firstly we should understand the word "Syntax". Actually, The rules for writing statements in a computer programming language is syntax of the language. All program statements are written according to these rules. A single mistake in these rules causes a syntax error. The compiler detects syntax errors. It does not compile a program that contains a syntax error. These error must be removed for successful compilation of a source program. These errors are, therefore, easy to locate and remove.

images (6).png

Logical error
The error in the logic of a program is logical error. The compiler cannot detect these errors. A program with logical error runs on the computer but it gives wrong results.
The logical errors may occur due to the following reasons:
•Data input is incorrect because the output of the program depends upon the input data.
•The sequence of operations in a program may be incorrect.

These are most difficult to locate and remove. To track logical error, all statements of the program are examined one by one.

images (5).png

Runtime error
Runtime error occur when a program tries to do something the computer system cannot perform. It is runtime error because they occur during the execution of a program.
A runtime error occurs when a program tries to:
•divide by zero
•call a function that does not exist.

The computer stops executing the program when a runtime error occurs and displays the nature of the runtime error.

images (3).png


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Good information

Great

Nice dost

Its great information for the beginners

Really great information about C++ for CS and IT student

Yeah of course dear friend

Good information.
Keep it up man.
To helpful.

Great information about C++ everyone beneficial from this post

great information

Upgrade your IDE bro for the god sake. :)