0% found this document useful (0 votes)
12 views

1 Introduction

C-Programming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

1 Introduction

C-Programming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

INTRODUCTION TO

PROGRAMMING
COMPUTER PROGRAM

 A computer program is a series of instructions written in the

language of the computer which specifies processing


operations that the computer is to carry out on data.

 It is a coded list of instructions that tells a computer how to

perform a set of operations.

 It directs a computer in performing various operations/tasks

on the data supplied to it.

 Computer programs may be written by the hardware

manufacturers, Software houses, or a programmer to solve


2
PROGRAMMING

 Programming is the process of designing a set of

instructions (computer programs) which can be used to


perform a particular task or solve a specific problem.

 It involves use of special characters, signs and symbols

found in a particular programming language to create


computer instructions.

 Programming involves the following activities; writing a

program, compiling the program, running the program,


debugging the programs.
3
CONT’D…

 A computer program performs the following:

1. Accepts data from outside the computer as its input.

2. Carries out a set of processes on the data within the


computer memory.

3. Presents the results of this processing as its output,


and

4. Stores the data for future use.

4
TERMS USED IN COMPUTER PROGRAMMING

 Source program (source code) - program statements

that the programmer enters in the program editor


window, and which have not yet been translated into
machine-readable form. Source code is the code
understood by the programmer, and is usually written in
high-level language or Assembly language.

5
TERMS CONT’D…

 Object code (object program) - program code

that is in machine-readable (binary) form. This is the


code/language the computer can understand, and is
produced by a Compiler or Assembler after
translating the Source program into a form that can
be readily loaded into the computer.

6
TERMS CONT’D…

 Syntax - Each programming language has a special

sequence or order of writing characters. The term Syntax


refers to the grammatical rules, which govern how words,
symbols, expressions and statements may be formed &
combined.

 Semantics - These are rules, which govern the meaning

of syntax. They dictate what happens (takes place) when


a program is run or executed.
7
PROGRAMMING LANGUAGES

 A programming language is a set of symbols (a language) which a

computer programmer uses to solve a given problem using a


computer.

 The computer must be able to translate these instructions into

machine-readable form when arranged in a particular sequence or


order.

 Programming languages are needed to allow human beings and

computers to talk to each other.

 Computers, as yet, are unable to understand our everyday

language or, in fact, the way we talk about the world. 8


TYPES OF PROGRAMMING LANGUAGES

There are two levels of programming languages;


 Low level languages
 Machine language – first generation
 Assembly language – second generation
 High level languages
 Third generation languages (3GLs)
 Forth generation languages (4GLs)
 Fifth generation languages (5GLs)

9
LOW-LEVEL LANGUAGES

 Low level languages are closer to the machine,

understood by the machine and are dependent on


the machine.

 Features of low level languages:

1. They are machine hardware-oriented.

2. They are not portable, i.e., a program written for one


computer cannot be installed and used on another
computer of a different family.

3. They use Mnemonic codes. 10


MACHINE LANGUAGE (1ST GENERATION
LANGUAGE)

 Instructions are in the form of a Binary code also called machine

code (1’s and 0’s) and are called machine instructions.

 Machine languages are the only languages understood by

computers.

 It is a programming language in which the instructions are in a

form that allows the computer to perform them immediately,


without any further translation being required.

11
MACHINE LANGUAGE
Abc D
10000011100010110010100000010010100
35bits=4.bytes
8bits=1byte
1024bytes=1kb
1024kb=1mb
1024=1gb
11101 110011 1110001
11110 111000 1110000 12
ASSEMBLY LANGUAGE (2ND
GENERATION LANGUAGE)

 Assembly Language was introduced in 1960s, also

referred to second generation language.

 Reduced programming complexity and provided some

standardization to build and applications.

 The 1 and 0 in machine language are replaced by with

abbreviations or mnemonic code.

13
ASSEMBLY LANGUAGE CONT’D…

 It consists of a series of instructions and mnemonics

that correspond to a stream of executable instructions.


It is converted into machine code with the help of a
program translator known as assembler. Languages of
this generation include IBM, BAL, and VAX Macro.
These languages were still dependent on the machine
they were developed on.

14
ASSEMBLY LANGUAGE CONT’D…

Common features of assembly language include:

 Mnemonic code used in place of the operation code part

of the instruction eg SUB for substract.

 Symbolic addresses which are used in place of actual

machine addresses. Example MEM1 to represent first


memory address.

 The symbolically written program has to be translated

into machine language before being used operationally.


15
EXAMPLE

An assembly program to add numbers stored in ax and


bx registers (memory)

 mov ax,60

 mov bx,50

 add ax,bx

16
ADVANTAGES OF ASSEMBLY LANGUAGE
OVER MACHINE LANGUAGE

 It is easy to locate and identify syntax errors, thus it

is easy to debug it.

 It is easier to develop a computer application using

assembly language.

17
ADVANTAGES OF LOW-LEVEL LANGUAGES
 The CPU can easily understand machine language without translation.

 The program instructions can be executed by the hardware

(processor) much faster. This is because; complex instructions are


already broken down into smaller simpler ones.

 Low-level languages have a closer control over the hardware, are

highly efficient & allow direct control of each operation. They are
therefore suitable for writing Operating system software & Game
programs, which require fast & efficient use of the CPU time.

 They require less memory space.

 Low-level languages are stable, i.e., they do not crash once written.
18
DISADVANTAGES OF LOW-LEVEL
LANGUAGES
 They are difficult to learn, understand, and write programs in them.
 Their programs are difficult to debug (remove errors from).
 The programs are very long; hence, writing a program in a low-level
language is usually tedious & time consuming.
 The programs are difficult to develop, maintain, and are also prone to
errors (i.e., it requires highly trained experts to develop and maintain
the programs).
 They are machine-dependent (specific), hence non-portable. This
implies that, they are designed for a specific machine & specific
processor, and therefore, cannot be transferred between machines
with different hardware or software specifications.
 It is not easy to revise the program, because this will mean re-writing
the program again.

19

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy