ISO C90 forbids mixed declarations and code in C

后端 未结 6 1836
余生分开走
余生分开走 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:57

    I think you should move the variable declaration to top of block. I.e.

    {
        foo();
        int i = 0;
        bar();
    }
    

    to

    {
        int i = 0;
        foo();
        bar();
    }
    

提交回复
热议问题