C Programming IT Programming Tutorials

C Programming Basics

In this article C programming basics, you can learn complete details about the step-by-step process involved in the compilation of the C code.

Introduction To C Programming Basics:

  •  Dennis MacAlister Ritchie developed C Programming Language in 1972 at At&T Bells Lab, Murray Hill, New Jersey.
  • It is a successor of ‘Basic Combined Programming Language‘ (BCPL), and B language is the typeless language.
  • The C language was developed specifically for personal computers with UNIX systems.
  • American National Standard Institue (ANSI) formalized the language in 1988.

Compilation and Process Involved:

C programming language resembles like English language which is readable by humans but the processor can handle only machine code that involves 0s and 1s and hence it is converted to machine code.

 The compilation is the process of converting high-level to machine-level language using the compiler (here GCC compiler is used).
 The process involved in the compilation process includes various phases. Let us see each phase in detail.

Compilation Process in C Programming

Preprocessing:

The C programming language includes four preprocessor directives MacrosFile inclusionConditional compilation, and #undef, #pragma directives.

They are not normal program statements so they do not end with a semicolon, instead begin with the # sign. Resolving the directives takes place even before the compilation of regular statements, hence given the name preprocessor directives.

Moreover, the preprocessing step involves expanding macrosexpanding include files that enclose the details about the predefined functions, and removal of comments, and the preprocessed output file is the input to the compiler.

Compilation:

The compilation is the process in which the compiler converts the preprocessed file to the assembly language.

Assembly Language:

The assembler converts assembly language code to machine code which includes object files and unresolved libraries.

Linking:

This is the process in which the link editor combines the library function with the main function and all the files into a single executable file.

Compiler Installation:

 Windows:

 You can download and install it from the following links.

  1. To develop C, C++ application, download Dev-C++ IDE.
  2. To run the C program in the Visual studio code
    • Install Visual Studio Code Editor Visual Studio Code – Windows.
    • Download C, and C++ Extensions, which provide the following features IntelliSense, debugging, and code browsing.
    • Also, download MinGW-w64 Compiler from the following link MinGW.

UNIX/Linux:
In UNIX/Linux, the GCC compiler is already installed. To check whether it is available or not, in the command prompt type

cc or GCC as     $gcc -v, or

you can download it from gcc.gnu.org/install if not available.

 MAC:

Xcode includes a GNU C/C++ compiler and you can download Xcode from Apple’s website using the link developer.apple.com/technologies/tools.

Recommended Articles

Leave a Reply

Your email address will not be published. Required fields are marked *