C Programming

What is C?

C is a procedure oriented, high-level programming language which serves various built-in functions and features like variable scope, recursion, dynamic memory allocation etc. C Language is very simple and easy to learn, thus it is perfect for learners and beginners. This language acts as a base for other complex languages and technologies. 

Birth of C:

C was designed by Dennis Ritchie, an American Computer Scientist in the year 1972 at AT & T's Bell Laboratories, USA.
Basically, C was developed to re-implement the UNIX operating system. C language is the successor of language B and BCPL. 

The journey of C:

  • K & R Version

    The first edition of C Programming Language was published in the year 1978 by Brian Kernighan and Dennis Ritchie. This book covers all the features and specifications of the C language. The version of C within this book is termed as K & R Version.

    Features of K&R C:

    • Compound Assignment Operators.
    • Datatypes: long int, unsigned int.
    • Standard Input/Output Library.
    • Void functions
    • Enumerations

  • ANSI C/ Version C89

    C Language was formalized by ANSI (American National Standard Institute) in 1989. This version of C language is known as ANSI C or C89.

  • ISO C/ Version C90

    Later, C was formalized by ISO (International Organization of Standardization) in 1990. This version is termed as C90.

  • Version C99

    After a few years, C was revised again in later 90's. Various new complex features were added. This version of was termed as C99.

    Features of C99:

    • Datatype: long long int, boolean.
    • Static arrays.
    • Flexible array members.
    • Compound Literals
    • Header files: stdint.h, complex.h, tgmath.h
    • Inline functions
    • Single line comments(//)

  • Version C11

    In the year 2007, a few more improvements and revisions were made in C.

    Features of C11:
    • Multithreading
    • Bound checking
    • Generic macros
    • Structures

  • Version C18

    C18 is the latest version launched in June 2018. There are no enhancements in the features of C but technical corrections are made.

Features of C:

  • A program written in C language can be compiled on a number of different platforms and operating systems. This makes the C language portable.
  • C language is very fast and efficient because it provides a low-level access to memory and minimal runtime which makes a program to execute in no time. 
  • C language is robust which provides a wide range of operators datatypes and functions. It helps in creating complex programs.
  • C teaches you the very basic programming skills. After learning C, you can easily learn any other complex language like C#, Java, Perl, Limbo etc as you would already have the sense of programming.
  • Many other languages are directly or indirectly related to C. Languages like Java, C#, C++, D, Go, UNIX's C Shell etc have adopted one or the other features of C.
  • C Language provides modularity. A program written in C consists of one or more functions. These functions individually perform a particular task. We can also create our own functions and store them in the C library.

C Library:

The most important feature of the C language is the library. C provides a number of built-in functions that perform basic tasks like taking input, displaying the output on the output screen, clearing the output screen etc. All these functions are stored in the library. 
These library functions can be used anytime in a C program.

Uses of C:

  • C is a language which provides fast execution process. Thus, a major section of operating systems like Linux/UNIX and Windows is made with C.
  • Most devices like digital cameras, smartphones, microwaves, washing machines etc need a microprocessor, an operating system and a program. This program is written in C language to achieve fast execution process.
  • C is a general-purpose language. It is used for developing 3-D movies, photo-editors and gaming frameworks. The primary need of a game is speed. A slow game would never be liked by a gamer. Thus, most of the games are based on C.

What do you need to SET UP THE CODING ENVIRONMENT for C?

There are two things you need-

  1. Text editor- A text editor is used to type the code. There are various text editors available, for example, notepad, notepad++, vim etc.
    After typing the code, the file needs to be saved with the .c extension. Now, this file is known as a source file, which contains your source code. This file is further compiled and executed.

  2. C Compiler- A compiler is simply a program which compiles the source code. By compiling, it means to convert the source code into computer understandable language i.e. the binary language (0 and 1).
    The source code is written in a human-readable form which is termed as High-Level Language. The compiler translates this high-level language into a computer-readable form which is termed as Low-Level Language.

Integrated Development Environment:

Integrated Development Environment (IDE) is a package consisting of an editor and a compiler. Working with IDE's makes coding quite simpler and smooth and less complicated.

IDE provides various facilities to the coders to simplify their work like code and syntax hints, corrections etc. Different IDE's are available for different operating systems.

Operating System IDE
MS-DOS Turbo C, Turbo C++, Microsoft C++
Windows Visual C++, Borland C++
Linux gcc Compiler

Turbo C++, Borland C++ and Microsoft C++ provide both, C and C++ Compilers.

As a beginner, you must choose Turbo C as it the most basic version. A number of websites are available to download Turbo C.

After installing Turbo C in your computer you can create, compile and executes c program by following the steps given below:

  • Open the Turbo C compiler. It is usually present in C:\TC\BIN directory.
  • Click on the File menu, select New option.
  • Create the program and save it with the .c extension.
  • To compile the program: Press Ctrl+F9 
  • To run the program: Press Ctrl+F9

What happens on compiling the program?

On compilation, a machine language version of the program is created and stored in a file. This file is known as Executable file and it saved with (.exe) extension.

This exe file can be readily used in any other machine without re-compiling.