Question:
C Programming Question?
2009-05-11 19:13:07 UTC
Hello,

I'm going to begin learning the C programming language, and I can't seem to find what file extension to use. I want to see what I program in action, so I guess my question is: what file extension do I save as, and how do I open and see my projects? I have tried that file extensions:

.c
.exe
.VBS
.htm
.html

If any of the above are correct please let me know, and what program should I use to open them?

*I am running Windows Vista
Four answers:
Shadow Wolf
2009-05-11 20:23:20 UTC
Most of your programs will have at least one file with a .C extension. All C programs normally use this extension. In addition, you may have one or more header files with the.H extension. If you use functions from the C libraries, you'll include the header files so the compiler knows what it is dealing with. Depending on the type of compiler you use and the environment you use, object files will either have a .O or a .OBJ extension. These are pretty much a pre-compiled library version of you functions and program. finally, the default output is either A.OUT or .EXE depending again on the compiler and the environment.



If you use an IDE, then there will be additional file types such as project .PRJ or similar file types that may be IDE specific. These files are really just a means of holding all the compile settings for your entire project.



There may also be other files that are both compiler, project and environment specific such as .ICO for a Windows icon graphic. You may have a MAKEFILE which is basically a compiler script to build a larger project.



Any text editor or IDE can open the .C and .H files. These are basic text files though an IDE will usually have syntax highlighting and similar features to help you see what you are doing. At a minimum, any program that can read and write text files will allow you to write C programs.



Next, the compiler will use your .C and .H files to make .OBJ or .O files. This is a sort of intermediate step in making an actual program you can run.



Lastly, a linker will combine all the .OBJ or .O files into a an executable which may or may not have a .EXE or perhaps simply A.OUT as the file name.



It appears to be a long process, but any IDE will automate most of this and it will be nearly invisible when you build a project.



I send most people to http://cprogramming.com since they have a number of links to free C/C++ tools as well as tutorials. It is one of the better C resources I've found on the net.



Shadow Wolf
Joe L
2009-05-11 19:29:26 UTC
.c is the standard extension for C files. You said you want to use C, not C++. You should be able to open and edit them using any text editor, like Notepad.



To run your program, you need a C compiler. Here's where to get a free one: http://gcc.gnu.org/
?
2016-10-05 10:27:50 UTC
no longer anymore, at one time C++ became in simple terms an extension of C. on the grounds that then, C has replaced, and so has C++. although that being suggested it somewhat is now common for the comparable software to gather the two C and C++. the ideas-set is the comparable, yet there are in simple terms some differences int he libraries which you somewhat desire the compiler to hyperlink to.
tbshmkr
2009-05-11 19:27:44 UTC
.c

-

Code::Blocks

http://www.codeblocks.org/downloads/5

codeblocks-8.02mingw-setup.exe


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