Question:
Can I compile C in Microsoft Visual C++ Express Edition?
Ruraga
2011-02-21 02:37:02 UTC
If yes, how? If no, what will be a good compiler to compile basic C?
Four answers:
Techwing
2011-02-21 02:53:50 UTC
Yes, you can compile C in Visual C++ Express. All you have to do is save the source file with a file name that ends in .c, instead of .cpp. Visual C++ Express assumes that source files with names ending in .cpp are C++, and that files ending in just .c are plain C, and it will compile them appropriately. You can also mix C++ and C files within a single project, if you wish.



C is not compiled the same way as C++. C is not merely a subset of C++. The Visual C++ compiler knows the difference and will make appropriate adjustments in compilation based on whether a source file is C++ (.cpp extension) or C (.c extension).
JoelKatz
2011-02-21 02:40:47 UTC
You might as well just write C code that can be compiled by a C++ compiler. The differences are so slight. You cannot name a function or variable using a C++ keyword, so no "int class;" or "void protected(int)", prototypes are mandatory, and there are a few cases where casts are required in C++ when they're not in C. Otherwise, the languages are compatible -- C++ is basically C with a few extra features that simplify object-oriented program. By developing C++-compatible code from the start, you won't learn bad habits that will get in the way of people using your code.
BLHylton
2011-02-21 02:41:16 UTC
C++ is compiled the same as C code nowadays, so yes.



Honestly, most compilers actually default the C differences to their C++ counterparts anyway. For example a struct in C is typically compiled like a public class in C++.
anonymous
2016-10-28 15:01:53 UTC
to convey mutually first you code must be mistakes/trojan horse loose. then press F5 to run with debugging, or ctrl+F5 to run without debugging. in case you code is mistakes loose and your challenge is a console software, you'll see the console window arise along with your software.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...