Syntax is the rules to C++ that define how we have to do things. For example: int myInt; is a way of declaring an int, it follows this syntax: datatype variablename;
Over the years, more and more syntax has been added to language to incorporate new features or syntax has been expanded to allow more options when defining things.
I don't have an actual definition of what syntax is, but maybe someone else can explain it better or even wikipedia (always seems to have the answers).
A specific way of writing a particular part of a code to declare variables,accessing functions or to accomplish any task in c++ is what i call syntax. It may not be the exact definition but u might have got the idea of it...
maybe someone else can explain it better or even wikipedia
Wikipedia is actually pretty easy to understand here:
"the syntax of a programming language is the set of rules that define the combinations of symbols that are considered to be correctly structured programs in that language"
Fine Yoda speaks. "I am good", "Good I am", and "Good am I" all use syntax properly. It's when you start to put words in the wrong order that you see bad syntax: "I good am", "Am good I". The final iteration changes the meaning, but still proper: "Am I good".
"Fine Yoda speaks" is a little confusing though, because you don't know if Yoda speaks fine or if there is something called a "Fine Yoda". We might write "Yoda speaks fine", but we could also do "Fine speaks Yoda" without issue. The problem word is the adjective, you can not have the adjective in the middle or your noun and verb.
I can't quite think of a polite way to say this, but that's just not correct. Grammar defines a syntax, no matter what language. They call these programming languages for a reason. A piece of code: int x = a;, basically says "make an integer named "x" and assign it the value of "a"". You can't do int x a =; because this says "Make an integer named "x" and value of "a" assign it". That sentence doesn't make sense, it isn't following syntax rules.
Edit: My nonsense sentence makes a little bit of sense though, perhaps if we changed the grammar of c++ we could do something like that.
Definition taken from Webster's dictionary. syn·tax
[sin-taks]
noun
1.
Linguistics .
a.
the study of the rules for the formation of grammatical sentences in a language.
b.
the study of the patterns of formation of sentences and phrases from words.
c.
the rules or patterns so studied: English syntax.