So I'm going to start a course on programming in C language and this is the first video. So I'm going to discuss some basic things in this video. Like what is need of programming? Why do you write programs? What is need of writing these programs?
What is need of programming languages? And then we will come to C language, right? So now let us discuss what is need of programming? Why do you write programs?
C, computer is what? It's you can say a machine or you can say a general purpose machine. The use of computer is what?
which can perform any task, any computational task, not any task, any computational task it can perform. Right. But how do you communicate with computer? Like suppose if you want to add two numbers, then it's not like that you will say, hey computer, I want to add two numbers, four and five.
So tell me what is the addition of four and five? No, computer will not understand your language. So now what you will do?
We will write some instructions. You can say sequence of instructions and we will give those sequence or set of instructions to computer and then according to that computer will perform your task. Right? So those set of instruction are what? Program.
Sequence of instructions are what? Programs. Right? That is why if you want that your computer will perform some task for you, you have to write programs.
Right? That is why we need to write programs. Fine. But now see. The language of computer is what?
Binary language. I hope everybody knows. 0 and 1. Computer can understand only 0 and 1. Binary. So if you write like if you write instructions in English language, Hindi language or in any language, computer will not understand.
Then what we will do that also we will discuss. How that language, how that program will be converted into 0 and 1 and then computer will perform your task. Fine.
So basically you can say what computer will do. run by programs computer is nothing without programs it cannot do anything without programs when you purchase a new laptop or computer that has already you know many programs are already there in that programs or you can sorry in your computer like some system programs application programs or you must have heard about system software application software software is what definitely it is a set of programs right so system programs means what they are going to manage that system resources they are going to manage the hardware and application programs or application software's are what they are basically used to perform your task your favorite task like web browser in is application software and text editor in which you you can edit you can write text you can edit text MS Office that is also a application software right but suppose if you want computer to perform your task any specific task according to that you have to write your own program and you have to submit that program you have to give that program to computer and then computer will understand your program or you can say those sequence of instructions and according to that will give you some output right so now how do you write programs like it's not like in simple english language you will write programs and submit to computer no it is not going to understand so for that thing we need programming languages right See when we communicate with each other like if I want to communicate with you then the language is maybe English, Hindi right? So and for communication what?
First of all you need to understand the alphabets. First we study what? A, B, C, D and then words.
Then we frame sentences by using grammars and all right? And then we communicate, then we frame sentences and then we communicate with each other. Same thing. in language also you need to learn something before writing the programs like the characters character set of that language keywords and some syntaxes and some rules right and then we can write programs and then we can interact with computers right but the point here is what computer can understand only zero and one and you are writing programs in what if suppose c language we take example of c language then definitely we are not going to write like 0 1 0 0 1 suppose i write this one this is a bunch of zeros and one but we are not able to understand what is meaning of this thing right but maybe computer can understand obviously computer will understand because it is language of computer right so we write what hash include stdio dot h hash include conu dot h then void main then integer a b int a b then printf scanf and everything so that program first of all have to be converted into this language, machine language, 0 and 1 form and then computer will execute your program or more specifically I would say CPU. Because it is what processor central processing unit.
This is processor. This is you can say heart of computer the calculation the computation The task which you are going you need to perform on computer that is going to be performed by CPU More specifically if I will say Then CPU will give you output, right? So if you write Program in this format.
This is what machine level language. I hope you have heard about machine level languages Assembly level languages then high level languages or low level languages middle level languages, right? But we will generally prefer to call high level languages, right high level languages means the C C++ Java These are understandable by human because if we write this if we see at this code Then we are not going we will not understand.
What is this? So this is machine level language, right? But before invention of these high level languages, they used to write programs in this format.
See, you can imagine how tough it was at that time to write program in this language, machine language because see, and this is what this is according to you know, those CPU architecture, some set of specifications are there which some architecture is there which CPU follows. I think you will or maybe you have studied the subject COI, computer organization and architecture. In that you must have studied those architectures. So according to those specifications, those architecture of the CPU, this code will differ. It means it is machine dependent.
In one computer, the same program like addition of two numbers. Let us suppose at one CPU. Suppose according to this CPU architecture or the specifications, the instruction can be given in 20 bits, like 20 bits, right? And first 4 bit are for operator. I hope everybody know like I suppose I am writing 1 plus 2, 1 and 2. These are operands and plus is operator.
Here we write as opcode. Suppose these first 4 bits are for this plus to indicate this plus. And suppose here plus, I will write like 0010, 0010. So computer will understand that this is for plus that he has to perform plus operation right and then next 8 bits are for 1 this operand and next 8 bit are for second operand.
We will write these two operands into binary form right like 0 0 0 7 0s and 1 and 2 how you will write this is 2 in binary form so that we will write here and when we submit this instruction then the CPU will perform addition of 1 and 2 and it will give you the result right. And suppose the according to the specification of CPU 2 second processor maybe there plus is 0001 right or maybe the length of the instruction is something else not 20 bits. So it's not easy to write programs in machine language because it is dependent on that machine to machine. So it is not the programs are not portable in one machine.
If you are writing program for addition, then again you have to write. write that program for second machine it's not like that the same program will run on second machine that is very difficult then assembly level languages come these levels we will discuss in a separate video with more details and after that high level languages come to overcome these limitations to add portability concept so that one program on one machine we write and that program can easily be ported to second machine means we can we can run that program same program on second machine also without any modification or maybe you can say with few modifications right so now let us discuss what is c language see it was developed by dennis ritchie in 1972 where bell laboratories the headquarter of these Bell Labs are where in New Jersey US right and it is before C the language was developed B language so you can say C is what successor of B language it was developed by Ken Thompson right why C language was developed at that time basically the main purpose was to you know write operating system that is Unix operating system that was already written in B language you But there was some limitation. So to overcome those limitations, because C was more powerful than B language.
Right. So they used to write the kernel of Unix operating system. They used this language, C language.
So C is basically you can say it's a system programming language. Many softwares have been written in C language. Oracle, Android, the core libraries of Android was written in C language.
Major part of web browser. browser is written in C language device drivers written in C language and Unix operating system so C is you can say the most popular programming language and during 1980s C was the most widely used programming language and in 1989 it was standardized by ANSI that is why after that it is called ANSI C and see how the computer is going to understand what whatever you will write in C language because here it is not machine level language here we are not going to write the bunch of zeros and ones right so first of all the program that you will write in C language that is to be converted into that object file or object code or you can say that machine code zeros and ones and who is going to convert it compiler That is why it is known as compiled language, right? And the program is written like the name of the program is ABC suppose and the extension of C program is dot C, right?
So the compiler is going to convert it into that OBJ file, object code, machine level code and then the CPU will run this program. The whole process we are going to discuss in a separate video like. the basic the execution how the program is going to be executed when it is going to be converted in object file by whom and what is the role of that linker and loader and executable file when executable file will be formed and then how you will get the output that also we'll discuss in a separate video the complete process one more thing is interpreter and the main task of interpreter is also to convert this program high level program into object code but the difference we will see in a separate video so now that's it for this video now i'm going to see in the next video till then bye bye take care