Why does #define not require a semicolon?

前端 未结 7 984
无人及你
无人及你 2020-11-27 21:03

I was writing some test code in C. By mistake I had inserted a ; after a #define, which gave me errors. Why is a semicolon not req

7条回答
  •  执念已碎
    2020-11-27 21:37

    #define is a preprocessor directive, not a statement or declaration as defined by the C grammar (both of those are required to end with a semicolon). The rules for the syntax of each one are different.

提交回复
热议问题