Visual Studio 2010 Compiling C code

前端 未结 3 1691
深忆病人
深忆病人 2021-01-28 09:18

I have the following code snippet. This is a c file in visual studio 2010. If i try to compile this with the line: int hello = 10; commented out it will compile just fine. If

相关标签:
3条回答
  • 2021-01-28 09:20

    typecasting a malloc return pointer in C is a bad practice and has undefined results.

    0 讨论(0)
  • 2021-01-28 09:33

    You can't have declarations (like int hello = 10;) after non-declarations (like *x = 5;) in C89, unlike C99 or C++.

    MSVC 2010 still does not support C99.

    0 讨论(0)
  • 2021-01-28 09:38

    you can still declare variables after coding. just change the "yourProject.c" file to "yourProject.cpp" and it will work fine.

    0 讨论(0)
提交回复
热议问题