How to compile and run C code? [closed]
I have purchased The C Programming Language ANSI C Version book for learning C. In that, there is no instruction for setting up the environment for developing the C programs.
Please help me how to compile and run the code explained in the book.
EDIT : I have Windows 7 installed as the OS"
You should use an IDE (Integrated Development Environment). I've chosen Code:Blocks a long time ago and I am still happy with it. Alternatively you can use NetBeans, Eclipse, DevCpp, ... There are a lot of IDEs for C or C++ available.
If on Mac/Linux, you can simply use make myprogram
(in a terminal) to easily compile a single-file C program where the source file is called myprogram.c
For more complex programs with several source files, system dependencies et c, it quickly gets much more complex. Use google to find the basics of GCC, the default compiler on UNIX systems.
If you're on Windows, you could either use the Visual Studio from Microsoft (excellent, but not free) or Eclipse with CDT.
This provides you a full IDE with nice debugging support.
However, if you don't want to use an IDE but learn to build programs from scratch, cygwin would be an option including GCC and Make.
精彩评论