Semicolon at the ends of if-statements and functions in C

后端 未结 7 951
猫巷女王i
猫巷女王i 2020-12-20 11:11

I just ran into some code that overuse semicolons, or use semicolon for different purposes that I am not aware of.

I found semicolons at the end of if-statements and

7条回答
  •  旧巷少年郎
    2020-12-20 11:49

    The first semicolon (after the if-statement) is just an empty expression which does nothing. I fail to see any point of having it there.

    The second semicolon (after the function) is an error since it is outside of any block of code. The compiler should give a warning.

提交回复
热议问题