10/14/2024
CSF,NU
7
Natural languages
These arethe languages through which the human beings
communicate with each other. For example:Arabic,English, French,
Pashto etc.
Programming languages
These are the languages through which the human beings
communicate with the computer.These are the most widely used
mediums between the user and the computer. Examples are C,
COBOL, PASCAL, BASIC, FORTRAN etc.
The programming languages are classified into three types:
Low level languages.
Middle level language
High level languages
8.
Low-Level Language
10/14/2024
CSF,NU
8
• Itconsists of two types of languages
• Machine language
• Assembly language
• Machine language
• Machine Language was the first language used for computers as a source of
communication.
• This is the only language which is directly understandable by the machine
(computer) and needs no translation programs (compiler,Assembler,
Interpreter).
• Machine language is the language of binary digits 0’s and 1’s(“0” means
“OFF” and “1” means “ON) that is why it is also called as binary language. It
is very difficult to write programs using 0’s and 1’s i.e. in machine
language.
• Thus machine language is totally machine dependent and is efficient for
computers and inefficient for programmers.
9.
10/14/2024
CSF,NU
9
A typeof language in which instructions are written in
binary from is called machine language
It is the only language that is directly understood by the
computer
Low-Level Language
10.
10/14/2024
CSF,NU
10
Assembly language
The computer professionals developed one step higher
language than the machine language which is calledAssembly
language .
The binary codes of machine language (0’s and 1’s) were
replaced by some special codes called mnemonics.
The programs inAssembly language are written using these
mnemonic codes as:ADD for addition, SUB for subtraction
MUL for multiplicationThese mnemonics are understandable
by the human but not understandable by the machine.
To make it understandable for the machine, a program called
assembler is developed its function is to translate a program
written in assembly language into machine language
Low-Level Language
11.
Middle level language
10/14/2024
CSF,NU
11
Middle Level Programming languages are closely related
to Machine as well as Human Being.
User can Use C language to do system programming for
writing operating system as well as application
programming.
12.
10/14/2024
CSF,NU
12
These languagesare fairly machine independent and English like.
High level languages are those languages in which programs are written
completely in English language. E.g. C++,Vb, Java, Python, PHP, R,…
The programmer can understand more easily and enable the programmer to
write instructions easily using English words and familiar mathematical
symbols such as if else, for, goto, +,- etc.
A program written in high-level language is translated into machine
understandable form with the help ofTranslation programs i.e interpreter or
compiler.
The high level languages are of two types:
Procedural languages/Structured languages.
OOP (Object Oriented Programming) languages
High Level Language
13.
A procedurallanguage is a type of programming
language that follows a structured approach to programming
through the use of procedures or routines. Here are some key
characteristics:
Key Features
Procedure-Based:
Programs are organized into procedures (also known as
functions or subroutines) that contain a sequence of statements
to be executed.
10/14/2024
CSF,NU
13
14.
Control Structures:
Utilizes control structures such as loops (for, while) and
conditionals (if, switch) to control the flow of execution.
Modularity:
Encourages breaking down complex problems into smaller,
manageable procedures, promoting code reuse and
organization.
Examples of Procedural Languages
C,PASCAL, COBOLE, FORTRON, BASIC, etc.
10/14/2024
CSF,NU
14
15.
Object-Oriented Programming(OOP) is a
programming paradigm that uses "objects" to design
software.
Popular OOP Languages
Java
C++
Python
C#
Ruby
10/14/2024
CSF,NU
15
16.
10/14/2024
CSF,NU
16
Is aspecial computer language used to create software.
A programming language is a vocabulary and set of
grammatical rules for instructing a computer or computing device
to perform specific tasks.
A programming language is a set of commands, instructions, and
other syntax use to create a software program.
Languages that programmers use to write code are called "high-
level languages."This code can be compiled into a "low-level
language," which is recognized directly by the computer
hardware.
A language used to write instructions for the computer.
Every statement in a programming language is actually a command
to the computer to perform the specific task.
Programming Language
17.
History
10/14/2024
CSF,NU
17
The Clanguage was created by Dennis Ritchie in 1972 at AT &T
Bell laboratory in USA.
Before C language their were more basic languages that were
called Cobol and FORTRAN .1960
Fortran language was used in engineering and Cobole was used in
commercial. after that in 1963 CPL language was created in
Cambridge university .
In 1965 Bcpl language was created .
In 1970 b language was created by ken tomson
In 1972 c language was created.
18.
Fortran language
10/14/2024
CSF,NU
1
8
FORTRANstands for FORmulaTRANsalting system .
It is used for engineering application and scientific use
BASIC LANGUAGE
Basic language is stand for beginnerAll purpose symbolic
instruction code
It was created at the late of 1960
It is used for education purpose
19.
Cobol language
10/14/2024
CSF,NU
COBOLstands for common Business Oriented Language
it is specially designed for business application
PASCAL LANGUAGE
PASCAL language is used for both scientific and business application
20.
C- LANUAGE
10/14/2024
CSF,NU
2
0
C-language is popular high level language
It was developed by Dennis Ritchie at AT &T Bell
laboratories in 1972
It provides the facilities to write application software as well
as system software
Why c language created?
C language is created for to run each kind of program.
21.
Why C StillUseful?
10/14/2024
CSF,NU
21
C provides:
Efficiency, high performance and high quality s/w
many high-level and low-level operations middle level
Stability and small size code
Provide functionality through rich set of function libraries
Gateway for other professional languages like C++ C#
Java
22.
10/14/2024
CSF,NU
22
Advantages of C
C is an all purpose programming language, such as solving
scientific and engineering problems, business application and
operating systems.
Many modern languages (like C++, Java, and Python) are
influenced by C. Learning C provides a strong basis for
understanding these languages.
C is hardware independent language, it works in all types of
computers
C contains the features of both, the low level and high level
languages
C is rich in operators.There are about 45 operators available in C
C is structure programming, which easy to maintain program
C has many library functions
23.
Learning of Clanguage
10/14/2024
CSF,NU
23
We learn c language for the cause of base to the
following language
C++,Java,C#...
Basic element can be used in advanced element
Management of language is inherited from c language.
For C language we use compiler
Compiler translate all program into machine code or
machine language but all at once.
24.
C++, C#or Java make use of a principle called Object
Oriented Programming (OOP) to organize programs which
offers many advantages.While using this organizing principle,
you need basic programming skills. So it makes more sense
to first learn C and then migrate to C++, C# or Java.
Though this two-step learning process may take more time,
but at the end of it, you will definitely find it worth the
trouble.
Major parts of popular operating systems likeWindows,
UNIX, Linux andAndroid are written in C. Moreover, if one
is to extend the operating system to work with new devices,
one needs to write device driver programs.These programs
are written exclusively in C.
10/14/2024
CSF,NU
24
25.
Common consumerdevices like microwave ovens, washing
machines and digital cameras are getting smarter by the day.
This smartness comes from a microprocessor, an operating
system and a program embedded in these devices.These
programs have to run fast and work in limited amount of
memory. C is the language of choice while building such
operating systems and programs.
The popular gaming frameworks (like DirectX) that are used
for creating games are written in C.
10/14/2024
CSF,NU
25
26.
Important issues forlearning of language
10/14/2024
CSF,NU
26
So a group of instruction is called program
10/14/2024
CSF,NU
28
C characterset consists of Numeric characters,Alphabetic
characters and special characters to represent information
Numeric character are 0 … 9
Alphabetic character are upper and lower-case letter of the English
language (A,B,C,…Z, a,b,c,…z) .
The C Character Set
29.
10/14/2024
CSF,NU
29
Special CharacterSet
The special characters are period (.), comma (,), Semicolon(;), Colon(:),
Single & double quotes (‘ & “), Plus & Minus sign (+ -),Asterisk(*),
Slash(/), Back Slash(), Equal Sign(=), Parentheses( ), Percent sign(%),
Less and Greater sign(< >), Hash or number sign(#),Ampersand(&),
Question Mark(?), Opening and Closing braces ({ }),
and other special characters including the blank character which is
equivalent to a space on the keyboard
The C Character Set
30.
Development with C
10/14/2024
CSF,NU
30
Four stages
Editing: Writing the source code by using some IDE or editor
Preprocessing or libraries: Already available routines
Compiling: translates or converts source to object code for a
specific platform source code → object code
linking: resolves external references and produces the
executable module
Portable programs will run on any machine but…..
Note! Program correctness is most important