C - Language Introduction

  1. C – Language proposed by Dennis Richie in 1969 at AT&T Bell Labs.
  2. It is an upgraded version of two earlier languages, called BCPL and B, which were also developed by Bell laboratories. 
  3. It is called a structured oriented programming language.
  4. C is the basic language in all programming languages.
  5. It is used to create system applications like games, drivers, and so on.
Why C programming language is required?
  • Before using c program, the program was written by assembly language i.e. Middle-level language.
  • Assembly languages were fully instruction based language so if any error comes, we cannot be found easily.
  • Because If one word has spelled a mistake in the program then it returns full program lines have error so we cannot find the exact error(i.e. error number is not displaying).
  • In C program using function concept for overcoming the above problem.
  • That means, it is used to find an exact error in the program and which block has an error.
  • Because the function is used to divide the program into smaller subprograms.
        For example,
  • The main() function have add(),sub() and mul() functions and one error in sub() block means C program easily identified and it checks only that blocks.
  • So using the C program save the compile-time and also we can be reusable the function code, so it reduces the number of lines.
  • This is the reasons for calling the C program as Function oriented programming language or Procedure oriented programming language.
The basic structure of C:

 //Command line
<Header files>
 Main function()
      Variable declaration
      I/O operation


 #include <conio.h>
 void main() 
     int a,b,c;
     printf("Enter a and b value : ");
     scanf("%d %d",&a,&b);
     printf("\nAddition of a and b value is: %d",c); 

Program explanation:
  • # - it’s called pre-processor and used to replace the values in variables. 
  • include - it's used to add header files and the user programs.
  • stdio.h - standard input and output header file(it holds printf and scanf of library files).
  • conio.h - stands for console input and output header file(used in old MS-DOS compilers to create text user interfaces and it holds clrscr() and getch() libraries).
  • void main() - main part
  • int – data type
  • a,b,c – variables
  • clrscr() – refresh output screen
  • printf – used to display the user entered details
  • scanf – used to get the value from the user and put into the memory location
  • %d - format specifiers
  • c=a+b – addition process and stored result in c variable
  • getch() – used to hold the output screen and wait until the user gives any type of input(i.e until the user press any key)
Output process in the backend:
Output process explanation in the backend:
Step 1: Write source code that is your program (refer above example program)
Step 2: Pre-processor
For example, a and b value is 5 and 4 then pre-processor replace the values
scanf(“%d %d”,5,4);
Step 3: Complier (convert the English language to machine level language)
To check the error and convert machine-level code (i.e. 0’s and 1’s)
Step 4: Assembler
Used to convert machine level language to human-readable language. (0’s and 1’s to normal text)
Step 5: loader and linker
Adding header files and pre-processor program
Step 6: Final output


No comments:

Post a Comment

Recent Posts

Service Support

Need our help to Learn or Post New Concepts Contact me