5 ms·
I haven't used Visual Studio to compile C in a long long time, but does it support compiling files as C files as well? For example: char ptr = malloc(10); //
by aninteger 11y ago
I haven't used Visual Studio to compile C in a long long time, but does it support compiling files as C files as well? For example:
char ptr = malloc(10); // this is not valid C++
vs
char ptr = (char *)malloc(10); // This is usually required for Visual C++ (or was).
- cmircea 11y agoYes, on the properties of the file you can specify whether to compile as C or C++. It can also be set as a project default. I believe files with the .c extensions are compiled as C, not C++.
- billforsternz 11y agoPlease edit to add an asterisk in front of ptr in both cases.
- awalton 11y agoIt's the markdown getting in the way. You can tell by the varying italics.
- billforsternz 11y agoIndeed. Still needs to be fixed.