1. C_Introduction
1. C_Introduction
How or where?
People in shops, factories, hospitals and schools use computers in lots of
different ways to do different types of jobs.
Tosolve mathematical equations, communication, analyze data, store
information, play games and find information through the Internet.
Application of Computers
Home
Education
Business
Health Care
Government
Media and Communication
Engineering Design
Military
and many more…
Application of Computers
app
How computer understand our command/direction to
solve a problem?
Communicating with a Computer
Speaker encodes Listener decodes User encodes Computer decodes
information information information information
Assemblers.
Interpreters.
Compilers.
Definition | Assembler
Assembled languages:
Assembler: a program used to translate Assembly language programs.
Producesone line of binary code per original program statement.
The entire program is assembled before the program is sent to the
computer for execution.
Definition | Interpreter
Interpreted Languages:
Interpreter: A program used to translate high-level programs.
Translates one line of the program into binary code at a time:
An instruction is fetched from the original source code.
The Interpreter checks the single instruction for errors.
The instruction is translated into binary code.
The binary coded instruction is executed.
The fetch and execute process repeats for the entire program.
Definition | Compiler
Compiled languages:
Compiler: a program used to translate high-level programs.
Translates the entire program into binary code before anything is sent
to the CPU for execution. The translation process for a compiled
program:
First, the Compiler checks the entire program for syntax errors
in the original source code.
Next, it translates all of the instructions into binary code.
• Two versions of the same program exist: the original source
code version, and the binary code version (object code).
Last, the CPU attempts execution only after the programmer
requests that the program be executed.
Interpreter Vs Compiler
A complier converts the high level instruction into lower level language
(e.g., assembly language or machine code) while an interpreter converts
the high level instruction into an intermediate form.
Thecompiler executes the entire program at a time, but the interpreter
executes each and every line individually.
List
of errors is created by the compiler after the compilation process
while an interpreter stops translating after the first error.
Autonomous executable file is generated by the compiler while interpreter
is compulsory for an interpreter program.
Interpreter is smaller and simpler than compiler
Interpreter is slower than compiler.
Interpreter Vs Compiler
compilerVSinterpreter
Building A Program
Whatever type of problem needs to be solved, a careful thought out plan of
attack, called an algorithm, is needed before a computer solution can be
determined.
Importance of C:
C language is efficient and fast.
C is highly portable.
C language is well suited for structured programming.
C is a machine independent language.
C has the ability to extend itself.
Basic Structure of C Program
C structure
Simple C Program
C program
Output
Web:
1. www.wikbooks.org
and other slide, books and web search.