# Introduction to C language

C language is a programming language.

Programming language is just like any another natural language(like English) that we used to share informations and for communication.

Natural language is bidirectional but programming language is not.

Programming language is used to give instructions(commands) to computer or any other devices.

Why their is need of programming language.

Because computer or any other device not understands natural language it only knows binary language that is 0 and 1 and it is impossible to learn binary language because it differ from one operating system to another.

#### EXECUTION OF PROGRAM

• Hard disk-Suppose you have a software on your laptop’s hard disk.example- Program.exe. When you double click to run program a copy is formed and goes to ram .
• Ram-Now,it is the duty of operating system to allocate(provide) memory to your program it is called as memory management. Ones your program gets memory next step is execution of instruction of program.Program is made up of instructions and data.

Example- Suppose a program is for addition of two numbers, here addition is an instruction and data is numbers that is used for addition.

• Processor(C.P.U)-  CPU have three sections.

• MU (memory unit): Set of registers(memory devices). One of the register is a instruction register which stores instructions.This instruction later goes to CU.
• CU (control unit): Circuit that reads instruction and decode it. After decoding it tells ALU what to do.
• ALU (arithmetic and logic unit): Does all arithmetic and logic calculations.

#### SOFTWARE DEVELOPMENT IN C LANGUAGE

Suppose you have to make a program sum.exe whose function is to add two numbers.This sum.exe is a operating system dependent program but c language is not a operating system dependent language so it’s better to learn c language rather then binary code.

OS does not understands c language. We define each and everything in c language by declerations etc

Let you have madded sum.c using c language. Next step is to convert this sum.c file into a software because sum.c is not a software to do this we use

• PREPROCESSOR  whose work is to handle all code lines started with # in a program.

Example-

#include<stdio.h> (preprocessor work is to include stdio.h file) (stdio refers to standard input output)
#include<conio.h> (preprocessor work is to include conio.h file) (conio refers to Console Input Output)

Here (include) means to include. (stdio.h) and (conio.h) is a header file. Header files are the file of extension .h and contains declerations of all predefined functions in c language.

Predefined functions like scanf and printf these are standard input output functions.So, if you want to use keyboard for inputing data you must use scanf  and to see output you must include printf and to use these two predefined function must include header file stdio.h which consist of declerations of all predefined functions.

CONCLUSION– PREPROCESSOR WORK IS TO HANDLE LINES STARTED WITH # AND REPLACE # LINES WITH HEADER FILE BEFORE ACTUAL COMPILATIONS AND AFTER INCLUDING HEADER FILES IT CONVERT  .c FILE TO NEW EXTENSION .i WITH THE SAME NAME.

• COMPILER work is to translate or to convert high level language (like c,c++ etc) to machine language (like binary etc).Also,compiler translate one page at a time.

In market different compiler comes for different operating system.

Now, sum.i get converted to sum.obj because of compiler.This .obj is a object file.

Still many lines are there in object file which a operating system does not understand and it is necessary to understand all lines for operating system to run a file.So,here we use library file.

• Library file -These file contain declarations of all such lines which a operating system does not understands.
• Linker– work is to link library files to object file to form a new file of extension .exe

Overall conclusion Preprocessor convert .c file to .i and compiler convert .i to .obj and linker convert .obj to .exe

Insert math as
$${}$$