Short answer: Yes, you need to rename .cpp files to c, so you can write C: https://msdn.microsoft.com/en-us/library/bb384838.aspx?f=255&MSPPError=-2147217396
From the link above:
By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code. To force the compiler to treat all files as C regardless of file name extension, use the /Tc compiler option.
That being said, I do not recommend learning C language in Visual Studio, why VS? It does have lots of features you are not going to use while learning C
Answer from 72DFBF5B A0DF5BE9 on Stack OverflowShort answer: Yes, you need to rename .cpp files to c, so you can write C: https://msdn.microsoft.com/en-us/library/bb384838.aspx?f=255&MSPPError=-2147217396
From the link above:
By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code. To force the compiler to treat all files as C regardless of file name extension, use the /Tc compiler option.
That being said, I do not recommend learning C language in Visual Studio, why VS? It does have lots of features you are not going to use while learning C
Yes, you very well can learn C using Visual Studio.
Visual Studio comes with its own C compiler, which is actually the C++ compiler. Just use the .c file extension to save your source code.
You don't have to be using the IDE to compile C. You can write the source in Notepad, and compile it in command line using Developer Command Prompt which comes with Visual Studio.
Open the Developer Command Prompt, enter the directory you are working in, use the cl command to compile your C code.
For example, cl helloworld.c compiles a file named helloworld.c.
Refer this for more information: Walkthrough: Compiling a C Program on the Command Line
Hope this helps
how to run program in c in visual studio code
Want to compile and run C programs on Visual Studio 2022
Can I compile pure C code in Visual Studio?
Hi How to run a c program on visual studio community 2022?
Videos
Guys CS Major here, uni is teaching with C and I want to build C programs (Not C++). I can go ahead and install code blocks, but I really want to use VS 2022 only. I know there is probably a way to make it but I dont seem to understand the linking of compiler. Can you guys please help me in installing it on Visual Studio 2022
I had VS Code to do my stuff which probably ran once and then gave some error. Since then I use online compilers to do stuff. The compiler was MinGW
Also I installed the C++ desktop environment on the Visual Studio community edition but when I go on to run the thing with #include <stdio.h> and stuff it does not recognise it.