Escolar Documentos
Profissional Documentos
Cultura Documentos
OBJECTIVES
In this chapter you will learn about:
Overview of PC components
The different types of language
Natural Language
Formal Language
Functional / Imperative Language
Programming Languages
C as an imperative language
C program at a glance
Overview of PC Components
Components of a PC
4
MAIN MEMORY
A semiconductor device which stores the
boot up
The information stays there permanently even when the
computer is turned off.
instruction register
STORAGE DEVICES
A magnetic device used to store a large amount of
information.
NETWORK DEVICES
Connect a computer to the other computers.
remotely.
NATURAL LANGUAGE
Our everyday-language; spoken and written
Not 100% needed to understand:
Do you want to buy this computer ? remains
comprehensible
Depends on circumstances; the context:
Do you like one ? doesn't make sense on its
one
someone pointing to an expensive car: your opinion is
asked
someone 'offers' you an oily cloth to sneeze: you don't
take it
11
given context
12
FORMAL LANGUAGE
Language with limited, defined, words
13
sum [1...10]
Imperative Language:
Tell what to do, but mainly how:
14
WHAT IS PROGRAMMING?
Programming is instructing a computer to do
PROGRAMMING LANGUAGE
Formal
16
PROGRAMMING LANGUAGE
Can be classified into as a special-purpose and
application
Assembly Languages
High-Level Languages
17
MACHINE LANGUAGE
The only language that the processor actually
'understands
Consists of binary codes: 0 and 1
Example:
00010101
11010001
01001100
ASSEMBLY LANGUAGE
Enables machine code to be represented in words
and numbers.
Example of a program in assembler language:
LOAD A, 9999
LOAD B, 8282
SUB B
MOV C, A
LOAD C, #0002
DIV A, C
STORE A, 7002
Easier
19
HIGH-LEVEL LANGUAGE
Use more English words. They try to resemble English
C PROGRAMMING LANGUAGE
Why 'C' ?
Because based on 'B'; developed at Bell Laboratories
Developed by Dennis Ritchie at Bell Laboratories in
the 1960s
Unix systems
21
C PROGRAMMING LANGUAGE
In 1983, the American National Standards Institute
compiler yet
22
C as an Imperative Language
C AN IMPERATIVE LANGUAGE
C is a highly imperative language
We must tell it exactly how to do what;
the means and functions to use;
which libraries to use;
when to add a new line;
when an instruction is finished;
in short: everything and anything
24
C Program at a Glance
A SIMPLE PROGRAM IN C
#include <stdio.h>
int main()
{
printf("I like programming in C.\n");
return 0;
}
26
int main()
Start of Segment
{
Function for printing text
}
End of Segment
End of statement
27
C OUTPUT
I like programming in C.
28
SUMMARY
We have looked at some underlying hardware
We have seen some different types of languages;
the relevance of semantics and syntax.
We have observed the detail necessary in an
29