What is the difference between syntax and semantics in programming languages?

后端 未结 10 1933
长情又很酷
长情又很酷 2020-12-04 04:51

What is the difference between syntax and semantics in programming languages (like C, C++)?

10条回答
  •  萌比男神i
    2020-12-04 05:21

    Syntax: It is referring to grammatically structure of the language.. If you are writing the c language . You have to very care to use of data types, tokens [ it can be literal or symbol like "printf()". It has 3 tokes, "printf, (, )" ]. In the same way, you have to very careful, how you use function, function syntax, function declaration, definition, initialization and calling of it.

    While semantics, It concern to logic or concept of sentence or statements. If you saying or writing something out of concept or logic, then you are semantically wrong.

提交回复
热议问题