what is syntax??
The rules for how things are written.
The syntax of a language determines which sentences are well-formed in that language. So in English, you might have a sentence like 'One is my favorite color.' This is a syntactically well-formed sentence in English, but as you can see, it doesn't mean anything (since numbers aren't colors!). In order for a sentence to be meaningful, though, it must be well-formed. So a sentence like 'Running purple one favorite.' can't have a meaning (except maybe in some loose, poetic sense! :), since it isn't well-formed.
grammar
syntax basically is how you should write so that the compiler understands what you are typing for example printf in c its syntax is printf("characters"); ending with a semicolon
My answer is no better than the above answers, but since the question is still open I'll add my answer and hope that it helps. Syntax is the set rules for how a language should be written. By "language" we could mean French, arithmetic, modal logic, programming language...each of those languages has a set syntax. For instance, "2 2 + 4 =" is syntactically incorrect whereas "2 + 2 = 4" is correct because it follows established syntactic rules (i.e. the operators always go in fixed places). Python has syntactic rules, C++ has syntactic rules...if something is a language of any kind, it has an established syntax.
Join our real-time social learning platform and learn together with your friends!