Differentiate between syntax and semantic.

Syntax refers to the set of rules that define the structure and format of valid statements in a programming language. It specifies how the elements of the language (such as keywords, operators, and identifiers) should be arranged to form proper instructions. For example, in C, a statement like int x = 5; follows the correct syntax.

Semantics, on the other hand, refers to the meaning behind the syntactically correct statements. It dictates how the computer interprets and performs actions based on the syntax. An instruction might be syntactically correct but semantically incorrect if it doesn’t make logical sense, such as dividing by zero.