I'm not sure, will the visual c ++ compiler express edition work for compiling c and if not can someone link me to an easy c compiler to use. Thanks in advance.
6 Answers
To add to Bill The Lizard's answer - any C++ compiler will compile a file using C language rules if the file has a .c
extension. This can be overriden to force a file to be compiled as C or C++ using command line options.
This is done with MSVC using the /Tc
or /TC
options to compile as C, and the /Tp
or /TP
options to compile as C++.

- 1
- 1

- 333,147
- 50
- 533
- 760
-
"any C++ compiler" may be effectively true, but it's not required to be true by any standard. – Darron Dec 02 '08 at 17:57
-
@Darron - understood, but this is not really a standards question, it's a tools question. – Michael Burr Dec 02 '08 at 18:00
Yes, it will work. C is a subset of C++ (for all but a very small number of exceptional cases). Any C++ compiler should work with valid C code.
See the answers to this question for some of the rare examples of C code that isn't valid C++.

- 1
- 1

- 398,270
- 210
- 566
- 880
-
4I wouldn't call it a subset. Those small number of exceptional cases are more than you might think. In any case it just so happens that VC++ is *also* a C compiler. Just save the file with the .c extension, and it will by default to C code. Alternatively you can pick the language in project settings – jalf Dec 02 '08 at 17:44
-
1In a strict mathematical sense, no, C isn't a proper subset of C++. However, well-written C tends to be valid C++. – Bill the Lizard Dec 02 '08 at 18:22
-
http://www.bloodshed.net/compilers/index.html
maybe there's something to your liking there.
also there's always gcc: http://gcc.gnu.org/

- 172
- 1
- 10
Depends partly on what C you're talking about. Visual C++ will happily compile C programs (make sure they've got a .c extension, and make sure the "Compile As" option in the "Advanced" part of the "C/C++" property pages is not set to C++ only), but is missing a whole lot of stuff in the C99 standard. If you're interested in the original standard C, Visual C++ will work very nicely.

- 56,304
- 9
- 91
- 158
Just small clarification - Visual C++ is not a compiler rather an IDE. The compiler will be cl.exe and as many sad there is no problem to compile C code with cl.
But there is other options like Windows ports of gcc or Watcom compiler

- 3,104
- 3
- 23
- 30