Open main menu

Wikibooks β

C Programming/What you need before you can learn

< C Programming
Previous: History Index Next: Using a Compiler

your function contains a single argument a one dimensional integer array size N in which ith element denotes the cist of 1 kg sweet from ith stall first line of input contains an integer N denoting size of array (1<=N<=10^5) Next N lines of input eacg containing a single interger from 1 to 9 c program

Getting StartedEdit

The goal of this book is to introduce and teach you to the C programming language. Basic computer literacy is assumed, but no special knowledge is needed.

Before you can start programming in C, you will need a C compiler. A compiler is a program that converts C code into executable machine code.[1]

Popular C compilers/IDEs include:

Name Website Platform License Details
Microsoft Visual Studio Express Visual Studio Windows Proprietary, free of charge Powerful and student-friendly version of an industry standard compiler.
Tiny C Compiler (TCC) tinycc GNU/Linux, Windows LGPL Small, fast and simple compiler.
Clang clang GNU/Linux, Windows, Unix, OS X University of Illinois/NCSA License A front-end which compiles (Objective) C/C++ using a LLVM backend.
GNU C Compiler gcc GNU/Linux, MinGW(Windows), Unix, OS X. GPL The De facto standard. Ships with most Unix systems.

The minimum software requirements to program in C is a text editor, as opposed to a word processor. A plain text Notepad editor can be used but it does not offer any advanced capabilities such as syntax hightlighting and code completion. There are many text editors (see List of Text Editors), among the most popular are Notepad++ for Windows, Atom, Sublime Text, Vim and Emacs are also available cross-platform. These text editors come with syntax highlighting and line numbers, which makes code easier to read at a glance, and to spot syntax errors.

Though not absolutely needed, many programmers prefer and recommend using an Integrated development environment (IDE) instead of a text editor. An IDE is a suite of programs that developers need, combined into one convenient package, usually with a graphical user interface. These programs include a text editor, linker, project management and sometimes bundled with a compiler. They also typically include a debugger, a tool that will preserve your C source code after compilation and enable you to do such things as step through it manually, or alter data as an aid to finding and correcting programming errors.

For beginners it is recommended not to use an IDE, since it hides most of what is going on. Using the command line builds up familiarity with the toolchain. An IDE may be useful to somebody with programming experience but knows how the IDE works. So as a general guideline: Do not use an IDE unless you know what the IDE does!

Other popular compiles/IDEs include:

Name Website Platform License Details
Eclipse CDT Eclipse Windows, Mac OS X, Linux Free/Libre and Open Source Eclipse IDE for C/C++ developement, a popular open source IDE.
Netbeans Netbeans Cross-platform CDDL and GPL 2.0 A Good comparable matured IDE to Eclipse.
Anjuta Anjuta Linux GPL A GTK+2 IDE for the GNOME desktop environment.
Geany geany Cross-platform GPL A lightweight cross-platform GTK+ notepad based on Scintilla, with basic IDE features.
Little C Compiler (LCC) lcc Windows Open Source but not Libre Small open source compiler.
Xcode Xcode Mac OS X Proprietary, free of charge Available free of charge at Mac App Store.
Pelles C Pelles C Windows, Pocket PC Proprietary, free of charge A complete C development kit for Windows.
Dev C++ Dev C++ Windows GPL Updated version of the formerly popular Bloodshed Dev-C++.
Microsoft Visual Studio Express Visual C++ Windows Proprietary, free of charge A powerful, user friendly version of an industry standard compiler.
CodeLite CodeLite Cross-platform GPL 2 Free IDE for C/C++ development.
Code::Blocks Code::Blocks Cross-platform GPL 3.0 Built to meet users' most demanding needs. Very extensible and fully configurable.

On GNU/Linux, GCC is almost always included by default.

On Microsoft Windows, Dev-C++ is recommended for beginners because it is easy to use, free, and simple to install. Although the initial developer (Bloodshed) hasn't updated it since 2005, a new version appeared in 2011, made by an independent programmer, and is being actively developed.[2] An alternate option for those working only in the Windows environment is the proprietary Microsoft Visual Studio Express which is free of charge and has an excellent debugger.

On Mac OS X, the Xcode IDE provides the compilers needed to compile various source files. The newer versions do not include the command line tools. They need to be downloaded via Xcode->Preferences->Downloads.


  1. Actually, GCC's(GNU C Compiler) cc (C Compiler) translates the input .c file to the target cpu's assembly, output is written to an .s file. Then as (assembler) generates a machine code file from the .s file. Pre-processing is done by another sub-program cpp (C PreProcessor), which is not to be confused with c++ the compiler.
Previous: History Index Next: Using a Compiler