ISO C90 forbids mixed declarations and code in C

后端 未结 6 1830
余生分开走
余生分开走 2020-11-29 02:13

I declared a variable in this way:

int i = 0;

I get the warning:

ISO C90 forbids mixed declarations and code

6条回答
  •  离开以前
    2020-11-29 02:42

    Make sure the variable is on the top part of the block, and in case you compile it with -ansi-pedantic, make sure it looks like this:

    function() {
        int i;
        i = 0;
    
        someCode();
    }
    

提交回复
热议问题