C_01 Introduction to C Language | C Programming Tutorials

Jenny's Lectures CS IT
14 Dec 202012:07

Summary

TLDRThis introductory video on programming in C language explores the necessity of programming, explaining how computers execute tasks through sequences of instructions, or programs. It highlights the importance of programming languages as a means to communicate with machines, which understand only binary language. The video delves into the evolution from machine-level to high-level languages, emphasizing C language's role in system programming, its development by Dennis Ritchie in 1972, and its significance in creating software like UNIX. The speaker promises to cover the compilation process and the role of compilers, linkers, and loaders in future videos, providing a foundational understanding before delving deeper into programming concepts.

Takeaways

  • 💡 Programming is essential for communicating with computers to perform tasks, as they only understand binary language (0s and 1s).
  • 🔢 Computers are general-purpose machines that can perform any computational task, but require specific instructions to do so.
  • 📝 A program is a sequence of instructions written to tell the computer what task to perform.
  • 🌐 The need for programming languages arises because computers do not understand human languages like English or Hindi.
  • 🛠️ Programming languages act as a bridge between human-readable code and the binary language that computers execute.
  • 🖥️ Computers come with pre-installed programs, including system software that manages hardware resources and application software for specific tasks.
  • 💻 Writing programs in simple English is not sufficient; they must be written in a programming language that the computer can understand and convert into machine code.
  • 🔑 The C language, developed by Dennis Ritchie in 1972, is a system programming language used for writing operating systems and other software.
  • ⚙️ C is a compiled language, which means that a compiler converts the human-readable C code into machine code that the CPU can execute.
  • 📚 The development of C was primarily to overcome limitations of the B language and to write the Unix operating system.
  • 🔄 High-level languages like C make programming more portable and less machine-dependent compared to lower-level machine or assembly languages.

Q & A

  • What is the primary purpose of programming?

    -The primary purpose of programming is to communicate with the computer by writing a sequence of instructions that the computer can execute to perform a specific task or computational process.

  • Why do we need to write programs for a computer to perform tasks?

    -We need to write programs because computers can only understand binary language (0s and 1s), and they require a set of instructions to perform any task that we want them to do.

  • What are the two main types of programs found on a new computer?

    -The two main types of programs found on a new computer are system programs, which manage system resources and hardware, and application programs, which are used to perform specific tasks for the user, like web browsers and text editors.

  • What is the difference between system software and application software?

    -System software manages the computer's resources and hardware, while application software is designed to perform specific tasks for the user, such as word processing or browsing the internet.

  • Why do we need programming languages to write programs?

    -We need programming languages because they provide a way for humans to communicate with computers. They are structured with characters, keywords, syntax, and rules that allow us to write programs that can be understood and executed by the computer.

  • What is the significance of C language in the history of programming languages?

    -C language, developed by Dennis Ritchie in 1972, is significant because it was used to write the UNIX operating system and is considered a system programming language. It was also the most widely used programming language during the 1980s and was standardized by ANSI in 1989.

  • What is the role of a compiler in programming?

    -A compiler converts the high-level language code, such as C, into machine-level code or object code, which consists of zeros and ones that the computer's CPU can execute.

  • Why is the C language considered a compiled language?

    -The C language is considered a compiled language because it requires a compiler to translate the code into machine-level instructions before it can be executed by the CPU.

  • What is the difference between high-level languages and machine-level languages?

    -High-level languages, like C, are more abstract and human-readable, while machine-level languages consist of binary code (0s and 1s) that the CPU can directly execute. High-level languages require a compiler to convert them into machine-level code.

  • Why was the C language originally developed?

    -The C language was originally developed to overcome the limitations of the B language and to write the UNIX operating system. It was designed to be more powerful and suitable for system programming tasks.

  • What are some examples of software that has been written in the C language?

    -Examples of software written in C language include the UNIX operating system, Oracle, Android's core libraries, major parts of web browsers, and device drivers.

Outlines

00:00

💻 Introduction to Programming and C Language

The first paragraph introduces the concept of programming, explaining why programs are necessary and how they communicate with computers. It emphasizes that computers are general-purpose machines capable of performing any computational task but require specific instructions to do so. The speaker clarifies that computers understand binary language and that programs are sequences of instructions written in a language the computer can interpret. The paragraph also touches on the presence of system and application software on new computers and the need for users to write their own programs for specific tasks. It sets the stage for discussing programming languages and the C language in particular, which is the focus of the course.

05:04

🔧 Understanding Programming Languages and CPU's Role

This paragraph delves into the evolution of programming languages, starting from machine-level languages to high-level languages like C and Java. It highlights the difficulty of writing programs in machine language due to its dependence on specific CPU architectures, making it non-portable across different machines. The paragraph introduces the concept of assembly languages and the importance of high-level languages in enhancing portability. It also discusses the development of the C language by Dennis Ritchie in 1972 at Bell Laboratories, its role in writing the UNIX operating system, and its prevalence in system programming. The speaker mentions that C is a compiled language, which requires a compiler to convert the code into machine code for execution by the CPU.

10:05

🛠 The Compilation Process and C Language's Legacy

The final paragraph focuses on the process of compiling a C program into an executable form that the CPU can understand and execute. It explains that the source code, typically with a '.c' extension, is compiled into an object file, which is then linked and loaded to form an executable file. The speaker promises to cover the complete process, including the roles of the compiler, linker, and loader, in a separate video. The paragraph also acknowledges the widespread use of C language in the 1980s and its standardization by ANSI in 1989. It concludes by setting expectations for the next video in the series.

Mindmap

Keywords

💡Programming

Programming is the process of writing sequences of instructions to enable a computer to perform specific tasks. It is central to the video's theme, as it discusses why programming is necessary and how it allows humans to communicate with computers. The script mentions that without programs, a computer cannot perform any computational tasks, highlighting the fundamental role of programming in making computers useful.

💡Computer

A computer, as described in the video, is a general-purpose machine capable of performing any computational task. It is the primary device that executes programs written by programmers. The script uses the term to explain that computers understand binary language, which is why programming languages act as a bridge for human-to-computer communication.

💡Binary Language

Binary language is the native language of computers, consisting of 0s and 1s. The video emphasizes that computers can only understand binary, which is why programmers write code that eventually gets translated into binary for execution. The script provides an example of how a simple addition operation in human language would be converted into binary for the computer to understand.

💡Programming Languages

Programming languages are formal languages designed to communicate instructions to a computer. The video discusses the importance of these languages as intermediaries between human-readable code and machine-understandable binary. It also differentiates between high-level languages like C, which are closer to human language, and low-level languages, which are closer to machine language.

💡C Language

C Language is a specific programming language highlighted in the video. It was developed by Dennis Ritchie in 1972 and is known for its role in system programming, including the development of the UNIX operating system. The script explains that C is a compiled language, which means that source code written in C must be compiled into machine code before it can be executed by a computer.

💡System Software

System software refers to the programs that manage the system resources and hardware of a computer. The video script mentions system software as a type of software that is pre-installed on new computers, which includes operating systems and other programs that manage the computer's functions.

💡Application Software

Application software, as discussed in the video, consists of programs designed to perform specific tasks for the user, such as web browsers and text editors. The script uses the term to illustrate how application software is different from system software, focusing on user-facing tasks rather than system management.

💡Compiler

A compiler is a program that translates code written in a high-level programming language into machine code. The video script explains that C language programs are compiled into object files, which are then executed by the computer's CPU. The compiler plays a crucial role in the process of turning human-readable code into executable machine code.

💡CPU (Central Processing Unit)

The CPU, or Central Processing Unit, is the primary component of a computer that performs the basic arithmetic, logic, and input/output operations. The video script describes the CPU as the 'heart' of the computer, emphasizing its role in executing the machine code produced by compilers.

💡Machine Level Language

Machine level language, as mentioned in the video, refers to the low-level language that a computer's CPU can directly execute. It is a series of binary instructions that are specific to the CPU architecture. The script contrasts machine level language with high-level languages like C, highlighting the difficulty in writing and porting machine-level code across different computer architectures.

💡Portability

Portability in the context of programming refers to the ability to run a program on different types of computers without modification, or with minimal modification. The video script discusses how high-level languages like C enhance portability, allowing programs to be easily transferred and executed on different machines, overcoming the limitations of machine-level languages.

Highlights

Introduction to the course on programming in C language.

Discussion on the necessity of programming and why programs are written.

Explanation of how computers perform computational tasks through programs.

The importance of programming languages as a medium to communicate with computers.

Computers understand binary language, consisting only of 0s and 1s.

Programs are sequences of instructions for computers to perform tasks.

Differentiation between system programs and application programs.

The role of application software in performing user-specific tasks.

The need for programming languages to write programs comprehensible to humans.

Learning the basics of a programming language involves understanding its characters, keywords, syntax, and rules.

C language was developed by Dennis Ritchie in 1972 at Bell Laboratories.

C language was created as a successor to the B language for more powerful capabilities.

C language is widely used for system programming, including writing the Unix operating system.

C language was standardized by ANSI in 1989, becoming known as ANSI C.

The process of converting C language programs into machine code by a compiler.

C language is a compiled language, requiring a compiler to translate it into executable machine code.

The role of the CPU (Central Processing Unit) in executing machine code.

Introduction to the concept of machine level, assembly level, high level, and low level languages.

The historical context and evolution of programming languages from machine code to high-level languages.

The upcoming discussion on interpreters and the difference from compilers.

Conclusion of the first video with a teaser for the next video in the series.

Transcripts

play00:00

so i'm going to start a course on

play00:01

programming in c language and this is

play00:03

the first video so i'm going to discuss

play00:05

some basic things in this video

play00:07

like what is need of programming why do

play00:09

you write programs what is need of

play00:10

writing these programs what is need of

play00:12

programming languages and then we will

play00:14

come to c language right so now let us

play00:17

discuss what is need of programming why

play00:18

do you write programs see

play00:21

computer is what it's you can say

play00:22

machine or you can say general purpose

play00:24

machine the use of computer is what

play00:26

which can be which can perform any task

play00:28

any computational task not any task any

play00:31

computational task it can perform right

play00:35

but how do you communicate with computer

play00:37

like suppose if you want to add two

play00:39

numbers then it's not like that you will

play00:42

say hey computer i want to add two

play00:44

numbers four and five so tell me what is

play00:46

the addition of four and five

play00:48

no

play00:49

computer will not understand your

play00:51

language

play00:52

so now what you will do

play00:54

we will write some instructions you can

play00:56

say sequence of instructions and we will

play00:58

give those sequence or set of

play01:00

instructions to computer

play01:02

and then according to that computer will

play01:04

perform your task right

play01:07

so those set of instruction or what

play01:09

program sequence of instructions are

play01:11

what programs right that is why if you

play01:14

want that your computer will perform

play01:16

some task for you you have to write

play01:17

programs right that is why we need to

play01:20

write programs fine

play01:22

but now see

play01:23

the language of computer is what

play01:25

binary language i hope everybody knows 0

play01:27

and 1 computer can understand only

play01:29

0 and 1 binary

play01:32

so

play01:33

if you write like if you write

play01:35

instructions in english language in the

play01:37

language or in any language computer

play01:39

will not understand

play01:41

then

play01:42

what we will do that also will discuss

play01:44

how that language how that program will

play01:46

be converted into zero and when and then

play01:48

computer will perform your task fine so

play01:50

basically you can say what computer run

play01:53

by programs computer is nothing without

play01:56

programs it cannot do anything without

play01:57

programs

play01:59

when you purchase a new laptop or

play02:00

computer that has already you know many

play02:03

programs are already there in uh that

play02:05

program so you can sorry in your

play02:07

computer like some system programs

play02:10

application programs or you must have

play02:12

heard about system software's

play02:13

application software software is what

play02:15

definitely it is a set of programs right

play02:18

so system programs means what they are

play02:20

going to manage that system resources

play02:23

they are going to manage the hardware

play02:25

and application programs or application

play02:27

softwares are what

play02:29

they are basically used to perform your

play02:31

task your favorite task like um web

play02:34

browser is application software

play02:36

and text editor in which you you can

play02:39

edit you can write text you can edit

play02:41

text ms office that is also a

play02:43

application software right but suppose

play02:46

if you want computer to perform

play02:49

your task any specific task according to

play02:51

that you have to write your own program

play02:54

and you have to submit that program you

play02:56

have to give that program to computer

play02:58

and then computer will understand your

play03:00

program or you can say those sequence of

play03:02

instructions and according to that will

play03:04

give you some output

play03:06

right so now how do you write programs

play03:08

like it's not like in simple english

play03:10

language you will write programs and

play03:12

submit to computer no it is not going to

play03:14

understand

play03:16

so for that thing we need programming

play03:18

languages right see when we communicate

play03:20

with each other

play03:22

like if i want to communicate with you

play03:24

then the languages may be english hindi

play03:26

right

play03:27

so and for communication what first of

play03:30

all you need to understand the the

play03:32

alphabets first we we uh

play03:34

study what abcd and then words

play03:38

then we frame sentences by using

play03:40

grammars and all right and then we

play03:42

communicate then we frame sentences and

play03:44

then we communicate with each other

play03:46

same thing in language also you need to

play03:49

learn

play03:50

something before before writing the

play03:52

programs like

play03:54

the characters

play03:55

character set of that language keywords

play03:57

and

play03:58

some syntaxes and some rules right and

play04:01

then we can write programs and then we

play04:03

can interact with computers

play04:05

right

play04:06

but the point here is what computer can

play04:08

understand only 0 and 1 and you are

play04:10

writing programs in what

play04:12

if suppose c language we take example of

play04:15

c language then definitely we are not

play04:17

going to write like 0 1 0 0 1 suppose i

play04:20

write this one

play04:21

this is a bunch of 0's and 1 but we are

play04:23

not able to understand what is meaning

play04:25

of this thing

play04:26

right but maybe computer can understand

play04:28

obviously commuter will understand

play04:30

because it is language of computer

play04:32

right

play04:33

so we write what hash include studio dot

play04:36

touch hash include corneo dot then word

play04:38

main then

play04:39

integer a b

play04:41

a b then printf scanf and everything

play04:44

so

play04:45

that

play04:46

program first of all have to be

play04:48

converted into

play04:50

this language machine language zero and

play04:53

one form

play04:54

and then computer will

play04:56

execute your program or more

play04:58

specifically i would say cpu

play05:03

because it is what processor central

play05:06

processing unit

play05:07

this is processor this is you can say

play05:08

heart of computer the calculation the

play05:11

computation the task which you are going

play05:13

you need to perform on computer that is

play05:15

going to be performed by cpu more

play05:18

specifically if i will say

play05:20

then cpu will give you

play05:22

output right so if you write

play05:24

program in this format this is what

play05:26

machine level language i hope you have

play05:28

heard about machine level languages

play05:30

assembly level languages then high level

play05:32

languages or low level languages middle

play05:33

level languages right but we will uh

play05:36

generally prefer to call high level

play05:38

languages right high level languages

play05:40

means the c c plus plus java these are

play05:43

understandable by human because if we

play05:46

write this if we see at this code

play05:49

then we are not going we will not

play05:50

understand what is this so this is

play05:52

machine level

play05:53

language right but before invention of

play05:56

these high level languages they used to

play05:58

write programs in this format see you

play06:00

can imagine how tough it was at that

play06:03

time

play06:04

to write program in this language

play06:06

machine language because see

play06:08

and this is what this is according to

play06:10

you know

play06:11

those uh cpu architecture some set of

play06:13

specifications are there which some

play06:15

architecture is there which cpu follows

play06:18

uh i think you will you or maybe you

play06:21

have studied the subject co a computer

play06:23

organization and architecture in that

play06:25

you must have studied those

play06:26

architectures right

play06:29

so according to those specification

play06:30

those arc architecture of the cpu this

play06:34

code will differ

play06:35

it means it is machine dependent in one

play06:38

computer

play06:39

the same program like addition of two

play06:41

numbers let us suppose uh

play06:44

in at one cpu

play06:45

right

play06:46

suppose according to the cpu

play06:48

architecture of the specifications the

play06:50

instruction can be given in 20 bits like

play06:53

20 bits right

play06:54

and first 4 bit are for

play06:57

operator i hope everybody know like i

play06:59

suppose i am writing 1 plus 2

play07:01

1 and 2 these are operands and plus is

play07:03

operator here we write as op code

play07:06

suppose these first 4 bits are for this

play07:08

class to indicate this plus and

play07:11

suppose here plus

play07:12

i'll write like 0 0 1 0 0 0 1 0

play07:17

so computer will understand

play07:19

that this is for plus

play07:22

that he has to perform plus operation

play07:24

right and then next 8 bits are for 1

play07:27

this operand and next eight bit are for

play07:29

second operand we will write these two

play07:32

operands into binary form right

play07:35

like zero zero zero seven zeros and one

play07:38

and two how you will write

play07:40

this is two in binary form so that we

play07:42

will write here and when we submit this

play07:44

instruction then

play07:46

the cpu will perform addition on one on

play07:49

one and two and it will give you the

play07:51

result right and suppose

play07:53

the according to the specification of

play07:55

cpu to second processor

play07:59

may be there

play08:01

plus

play08:02

is 0 0 0 1

play08:05

right or maybe the length of the

play08:07

instruction is something else not 20

play08:09

bits

play08:10

so

play08:11

it's not easy to write programs in

play08:13

machine language because it is dependent

play08:15

on

play08:16

that machine to machine so it is not the

play08:19

programs are not portable in one machine

play08:21

if you are writing program for edition

play08:23

then again you have to write rewrite

play08:25

that program for second machine it's not

play08:27

like that the same program will run on

play08:29

second machine

play08:30

that is very difficult then

play08:32

assembly level languages come

play08:34

these levels will discuss in a separate

play08:37

video with more details and after that

play08:39

high level languages come to overcome

play08:41

these limitations to add portability

play08:43

concept so that one program on one

play08:46

machine we write and that program can

play08:48

easily be ported to second machine means

play08:51

we can

play08:52

we can run that program same program on

play08:54

second machine also without any

play08:56

modification or maybe you can say with

play08:58

few modifications

play09:00

right so now let us discuss what is c

play09:02

language

play09:03

see it was developed by dennis ritchie

play09:05

in 1972 where bell laboratories the

play09:09

headquarter of these bell labs are where

play09:12

in new jersey u.s right

play09:14

and it is before c the language was

play09:16

developed b language

play09:19

so you can say c is what successor of b

play09:22

language it was developed by uh

play09:24

ken thompson right why c language was

play09:27

developed at that time basically the

play09:30

main purpose was

play09:32

to uh you know uh

play09:34

write operating system that is unix

play09:36

operating system

play09:37

that was already written in b language

play09:40

but there was some limitations so to

play09:42

overcome those limitations because c was

play09:45

more powerful than b language right

play09:48

so they used

play09:50

to

play09:51

write the kernel of unix operating

play09:53

system they used this language c

play09:56

language so c is basically you can say

play09:58

it's a system programming languages

play09:59

language many softwares have been

play10:01

written in c language oracle android the

play10:05

core libraries of android was written in

play10:07

c language

play10:08

major part of web browser is written in

play10:11

c language device drivers written in c

play10:14

language and unix operating system so c

play10:17

is you can say the most popular

play10:18

programming language and during 1980s c

play10:22

was the most widely used programming

play10:25

language

play10:26

and in 1989 it was standardized by ansi

play10:30

that is why uh after that it is called a

play10:33

nsic

play10:34

and see

play10:35

how the computer is going to understand

play10:37

what whatever we will write in c

play10:39

language because here it is not machine

play10:41

level language here we are not going to

play10:42

write the bunch of zeros and ones right

play10:45

so first of all the program that you

play10:47

will write in c language that is to be

play10:49

converted into that object uh file or

play10:53

object code or you can say that machine

play10:55

code zeros and ones and who is going to

play10:57

convert it compiler

play11:00

that is why it is known as compiled

play11:02

language right and the program is ah

play11:05

written like the name of the program is

play11:07

abc suppose and the extension of c

play11:09

program is

play11:11

dot c right so uh the compiler is going

play11:14

to convert it into that obj file object

play11:17

code machine level code and then

play11:19

the cpu will run this

play11:22

program the whole process we are going

play11:23

to discuss in a separate video like the

play11:26

basic the execution how the program is

play11:27

going to be executed when it is going to

play11:29

be converted in object file by

play11:32

whom and what is the role of that linker

play11:34

and loader and executable file when

play11:37

executable file will be

play11:39

formed and

play11:40

then

play11:41

how you will get the output that also

play11:43

will discuss in a separate video the

play11:45

complete process one more ah thing is

play11:47

interpreter and the main task of

play11:49

interpreter is also

play11:51

to convert this program high level

play11:53

program into object code but the

play11:55

difference will see in a separate video

play11:57

so now that's it for this video now i'm

play11:59

going to see in the next video till then

play12:00

bye take

Rate This

5.0 / 5 (0 votes)

Related Tags
C LanguageProgramming BasicsComputer CommunicationBinary LanguageMachine CodeHigh Level LanguagesSystem ProgrammingCompilersDennis RitchieUNIX OSANSI C