In this introduction of C, we will explore what is C Programming is about? And what make C a great programming language of all time. C is high level language and also most commonly used programming language for writing operating systems. C is simple programming language with few keywords and a relatively easy to understand syntax. C requires the use of libraries all the time that’s why even most basic “hello world!” Program has #include <stdio.h> header file which provides input/output command to C program. As C is matured high level language, the aim of any high-level computer language is to provide an easy, natural way to give a list of instructions (a computer program) to a computer. The native language of the computer is a stream of numbers called machine language. As you might expect, the action resulting from a single machine language instruction is very primitive, and many thousands of them can be required to do something substantial. A high-level language provides a set of instructions you can recombine creatively and give to the imaginary black boxes of the computer. The high-level language software will then translate these high-level instructions into low-level machine language instructions.
Why C Programming?
The design of C programming language is famous for its ability to produce portable code while maintaining performance. This is useful for operating systems and embedded systems development where performance matters a lot. The feature of memory allocation separates C from many other programming languages. C allows programmer to write directly into memory. In C programming the construct such as structs, pointers and arrays are designed to structure and manipulate memory efficiently. C gives control over memory management. Moreover programmer allowed for dynamic memory allocation. In programming languages such as JAVA and Perl programmer have to worry about memory allocation and pointers. When dealing with low level code for OS or device driver development, C provides uniform and clean interface. This capability can’t be supported by many other programming languages. The most popular high level languages such as Perl, PHP and Python etc… Are all written in C.
Compiler for C Programs:
Once we write our C programs then we all need to compile C file. The compiler usually operates in orderly sequence of phases called passes. The sequence happens approximately like this:
- First, the compiler reads the source code, perhaps generating an intermediate code (such as pseudo-code) that simplifies the source code for subsequent processing.
- Next, the compiler converts the intermediate code (if there is any) or the original source code into an object code file, which contains machine language but is not yet executable. The compiler builds a separate object file for each source file. These are only temporary and are deleted by the compiler after compilation.
- Finally, the compiler runs a linker. The linker merges the newly-created object code with some standard, built-in object code to produce an executable file that can stand alone.
To run the compiled program we will be using free and open source Code Block IDE (Integrated Development Environment). Code Block is cool IDE easy to use and support multiple compilers, including GCC, MinGW, MS Visual C++, Boarland C++, Intel C++ Compiler, etc…Although the IDE was designed for C++ language, it runs C programs as well. There are list of features Code Block offers:
- Compiler Support: GCC, MinGW etc.
- Code Editor: Syntax highlighting, Code folding, Project Management etc
- Debugger: full breakpoint support. It also allows the user to debug their program.
- GUI Designer: comes with a GUI designer called wxSmith.
There is lot about Code::Block you can read on their website. In entire series of tutorials we will be using Codeblock with MinGW. This is it for this introduction of C programming. In next post we will jump start on setting up code block on windows and run most famous Hello World! Program.