C: why are extra semicolons OK?

前端 未结 7 874
长发绾君心
长发绾君心 2021-01-25 06:20
#include 

int main() {
    int a = -1, b = -10, c = 5;
    if (a > b)
        printf(\"Hello World\");
    else
        printf(\"Get out World\");;;;;         


        
7条回答
  •  时光取名叫无心
    2021-01-25 07:03

    It's a null statement which you have after the printf() statment. Having more than one semi-colons is allowed.

    C11, §6.8.3, 4

    A null statement (consisting of just a semicolon) performs no operations

提交回复
热议问题