Home Show/Hide Menu
C Tutorials
➜ C Language
  - Features of C
  - First C Program
  - Compilation in C
  - C Character Set
  - Tokens
  - Keywords
  - Identifiers
  - Constants
  - Operators
  - Data Types
  - Variables
  - Type Casting
  - Comments
  - Input/Output
  - Escape Sequence
  - Programming Errors
➜ Control Statements
  - if Statement
  - if-else Statement
  - Nested if-else
  - else-if
  - switch Statement
  - Loop
  - while loop
  - do while loop
  - for loop
  - break
  - continue & goto
  - Nested Loop
  - Infinite Loop
➜ Functions
  - What is function
  - Call by Value & Reference
  - Recursive function
  - Storage Classes
➜ Array
  - 1-D Array
  - 2-D Array
  - Return an Array
  - Array to Function
➜ C Pointers
  - Pointers
  - Pointer to Pointer
  - Pointer Arithmetic
  - Dangling Pointers
  - sizeof() operator
  - const Pointer
  - void pointer
  - Dereference Pointer
  - Null Pointer
  - Function Pointer
  - Function pointer as argument
➜ Memory Management
  - Memory Layout of C
  - Dynamic memory
  - calloc()
  - malloc()
  - realloc()
  - free()
➜ Strings
  - gets() & puts()
  - String Functions
  - strlen()
  - strcpy()
  - strcat()
  - strcmp()
  - strrev()
  - strlwr()
  - strupr()
  - strstr()
➜ C Math
  - Math Functions
➜ Enum, Structure & Union
  - Enum
  - Structure
  - typedef
  - Array of Structures
  - Nested Structure
  - Structure Padding
  - Union
➜ File Handling
  - fprintf() fscanf()
  - fputc() fgetc()
  - fputs() fgets()
  - fseek()
  - EOF and feof()
  - fsetpos()
  - tmpfile()
  - rewind()
  - ftell()
  - lseek()
➜ Preprocessor
  - Preprocessor
  - Macros
  - #include
  - #define
  - #undef
  - #ifdef
  - #ifndef
  - #if
  - #else
  - #error
  - #pragma
➜ Command Line
  - Arguments

Compilation process in C language

The C compilation method converts the source code into the object code or machine code. The compiler checks the source code for syntactic or structural errors and produces the object code.
The method of compilation process can be divided into four stages, i.e., Pre-processing, Compiling, Assembling, and Linking.

  • Pre-processor - The pre-processor takes the source code ".c" file as an input, and it extracts all the statements removing comments from the source code. If <stdio.h>, the directive is available in the source code, then the preprocessor interprets the directive and replace it with the content of the "stdio.h" file.
     
  • Compiler - The source code expanded by the pre-processor is passed to the compiler. The source code is converted into assembly code by the compiler that means the C compiler transforms the pre-processed code into assembler readable code.
     
  • Assembler - The converted assembly code is translated into object code with the help of an assembler. The name of the object file is same as the source file with extension of ".obj" in DOS or ".o" in UNIX operating system. If the source file is "firstprog.c", then it would be the object file "firstprog.obj".
     
  • Linker - The linker combines the object code with required C library functions to make an executable program. This step typically involves adding in library files that are required and combines them into a single executable file, library file, or another "object" file.
     


Let us look at the steps of execution of C program "firstprog.c" :


ADVERTISEMENT