What is the difference between syntax execution error




















Nowadays, all famous IDEs such as Eclipse, NetBeans, and Visual Studio to name a few detect these errors as you type and underline the erroneous statements with a wavy line. You must correct all the errors and then try to execute the program again. Logic errors are those errors that prevent your program from doing what you expected it to do.

With logic errors you get no warning at all. That kind of an error is known as a logical error. This article discusses the difference between a syntax error and a logical error. The key difference between syntax error and logical error is that, the syntax error occurs due to an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language while logical error is an error that occurs due to the fault in the program algorithm or the logic.

Overview and Key Difference 2. What is Syntax Error 3. What is Logical Error 4. Generally, the programs are written using high-level programming languages. C, Python , Java are some examples of high-level programming languages.

The source code is easy to read and understandable by humans. These programs are not understandable by the computer. The computer only understands machine code. Therefore, the high-level program is converted into machine code using a compiler. Each programming language has own set of syntax to write the program. The programmer should write the program according to the correct syntax. If not, it will cause an error. This error type is known as a syntax error.

This error occurrs at the time of compilation. Few run time errors are as follows. Assume there is an integer and the programmer divides that integer by zero. This is a run time error. Also, assume that there is an array in the program that stores five numbers int array1[5].

Accessing the element array1[10] will give a run time error. Furthermore, accessing memory that is not available is also a run time error. When writing a program, the programmer should follow the proper standards and syntax of that language. Violating the grammar rules of the program can cause syntax errors.

In other words, it is a mistake in the syntax of a sequence of characters or tokens when writing a program using a specific programming language. Skip to content. Change Language. Related Articles. Table of Contents. Save Article. Improve Article.



0コメント

  • 1000 / 1000