Syntax errors or diagnostic errors are identified by the compiler. These errors occur when a program does not conform to the grammar of a programming language, and the compiler cannot compile the source file. A syntax error is an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language. Common syntax errors include missing or misplaced ';' or '}', missing return type for a procedure, missing or duplicate variable declaration, type mismatch on assignment, type mismatch between actual and formal parameters, etc. Logic errors occur when a program does not do what the programmer expects it to do. Since these errors are due to wrong logic in the program, logic errors cannot be identified by the compiler; they are detected only when the program is executed.
This Question is Also Available in:
हिन्दीಕನ್ನಡ