When can I omit curly braces in C?

后端 未结 9 1948
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 09:14

I\'m almost certain this has been asked before, but I can\'t find it being answered anywhere.

When can I omit curly braces in C? I\'ve seen brace-less return

9条回答
  •  情书的邮戳
    2020-11-29 09:45

    The following seems a little tricky:

    if (...)
    
            printf("I'm conditional\n");
    

    I guess the C preprocessor takes care of empty lines, so this statement is fine. Very bad practice of course.

提交回复
热议问题