+ 1
what is a sematic error? can you please give and example. and is x+y=z; a sematic error?
2 Answers
+ 7
Nope... there is a difference between semantic and syntax error. Semantic errors are the one where the commands written are not meaningful.
For eg. In your case, x+y can not come to the left of the assignment operator z.
Hence the correct statement is z=x+y.
Whereas a syntax error is the one where a grammatical rule of c++ is violated.
For eg. cin<< a is wrong.
- 2
semantic error is nothing but a syntax error