Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • It is one of the differences between the C89 and C99 standards. MSVC doesn't support C99. Commented Sep 30, 2012 at 19:22
  • What Hans said, but note, when compiling C files as C files. Compiling everything as C++ obviously changes that. It is a configurable option in the MSVC compiler settings whether to compile C as C++ or C. Commented Sep 30, 2012 at 19:24
  • @Hans Does MSVC actually support all of C89? It was my impression that it doesn’t really support C at all, just a subset of C++ which Microsoft insists on calling “C” but which really is just a reduced feature set. Commented Sep 30, 2012 at 19:25
  • Side notes: 1. Do you have to allocate z and i dynamically? They look like simple size and loop variables! 2. If you do, you should also free them. 3. type *var = malloc(size * sizeof(*var)); is much more maintainable as you don't repeat type over and over again. Commented Sep 30, 2012 at 19:29
  • @Shahbaz I did that because I thought it would allow me to declare variables in the middle of the function (but it looks like it has nothing to do with it) Commented Sep 30, 2012 at 19:41