Is if(TRUE) a good idea in C?

后端 未结 17 3388
忘了有多久
忘了有多久 2021-02-19 01:19

In the C programming language, it is my understanding that variables can only be defined at the beginning of a code block, and the variable will have the scope of the block it w

17条回答
  •  别那么骄傲
    2021-02-19 01:39

    As far as I know you can create a scope without if.

    Use just the braces like this:

    {
        int x;
    
    }
    

    And I recommend against

    if (TRUE)
    

    since it hinders readibility.

提交回复
热议问题