2.8 syntax errors
what can cause a syntax error
any mistake can cause a syntax error ranging from a (,) instead of a (;) the compiler tries to fix it wherever possible
how can you prevent logic errors
by carefully desk checking the algorithm and the program before you type it in
how can you detect logic errors
by testing the program thoroughly, comparing its output to calculated results
what happens if a statement has a syntax error
it cannot be translated and your program will not execute
how is a logic error different from the rest
it does no cause run-time errors and does not display error messages, they are very hard to detect
what is a syntax error
it is a violation of the C grammar rules, detected during program translation (compilation)
what is a runtime error
it is an attempt to perform an invalid operation, during program execution
what is a logic error
it is an error caused by following an incorrect algorithm
what are the three kinds of errors
syntax errors, runtime errors, and logic errors
what happens with a runtime error
the computer wil stop executing your program and will display a diagnostic message that indicates the line where the error was detected
what is the only sign of a logic error
the only sign may be an incorrect program output