Professional Documents
Culture Documents
Introduction to C
Programming
Chapter 1
PROGRAMMING
DEC20012 FUNDAMENTALS
MOHD ZEID ABU BAKAR
ELECTRICAL ENGINEERING DEPARTMENT
SULTAN IDRISSHAH POLYTECHNIC
OBJECTIVES
C
At the end of lesson, students should be
able :
Chapter 1 • To describe the C programming
• To explain the background of C programming
• To describe sample of C programming
• To explain the compile and execute process
• To define program, programmer &
programming language
• To describe various types of programming
languages
• To explain structured, modular & Object
Oriented programming
ZEDZ@PSIS
www.company.com
PROGRAMMING LANGUAGE ?
C
Chapter 1
ZEDZ@PSIS
www.company.com
THE PROGRAMMING LANGUAGE
C
• Conceptually a framework within
which we organize our ideas about data
(object to be manipulated) and
Chapter 1
procedures ( how to manipulate the
data)
• Technically instructions for the
computer to perform tasks
ZEDZ@PSIS
www.company.com
THE PROGRAMMING LANGUAGE
C
• Artificial language that can be used to
control the behaviour & properties of a
Chapter 1 computer.
- Applications
- Low Level Language @ Machine Language.
- Server
- Assembly Language
- Utilities
- High Level Language
- System Software
- Embedded System
ZEDZ@PSIS
www.company.com
THE PROGRAMMING LANGUAGE
C
• Low Level Languages:
• Easily understood by computers
• Difficult to understand by humans
Chapter 1
• Assembly Languages:
• Similar to the machine language
• The machine language contains numerical
information while the assembly language has
characters.
ZEDZ@PSIS
www.company.com
THE PROGRAMMING LANGUAGE
C
Chapter 1
ZEDZ@PSIS
www.company.com
THE PROGRAMMING LANGUAGE
C
• BASIC:
• Beginners All-purpose Symbolic Instruction
Code.
Chapter 1 • Originally designed to be simple enough for
beginners to learn.
• FORTRAN:
• Formula Translator.
• Designed for programming complex
mathematical algorithm.
• COBOL:
• Common Business-Oriented Language.
• Designed for business applications.
ZEDZ@PSIS
www.company.com
THE PROGRAMMING LANGUAGE
C
• Pascal:
• A structured general purpose language
designed primarily for teaching programming.
Chapter 1
• C:
• A structured, general purpose language
developed at Bell Lab which offers both high
level & low level features.
• C++:
• Based on C & offers object oriented features
not found in C.
ZEDZ@PSIS
www.company.com
THE PROGRAMMING LANGUAGE
C
• Java:
• An object-oriented language invented at Sun
Microsystem. Used to develop web based
Chapter 1 programs .
• Visual Basic:
• A Microsoft programming language & software
development environment .
• Allows programmer to quickly create Windows
based application.
ZEDZ@PSIS
www.company.com
WHAT IS C ?
C
• A high level structured & procedural
programming language.
ZEDZ@PSIS
www.company.com
BASIC ELEMENTS OF C
C
• Semantics
• Vocabulary of commands that human can
understand and can be converted into
Chapter 1 machine language.
• Syntax
• Language structure (grammar) .
IPS!
T
Think semantics as the building blocks of your C program and
the syntax as the correct way to put them together.
ZEDZ@PSIS
www.company.com
WHAT IS A PROGRAM ?
C
• Definitions
• An organized set of instructions that tells the
computer what to do or how to do it.
Chapter 1
• Is a text file (source file) containing sequence
of C commands (semantics) put together
according to the C grammar (syntax).
ZEDZ@PSIS
www.company.com
WHAT IS A PROGRAM ?
C
• Is a text file (source file) containing
sequence of C commands (semantics)
put together according to the C grammar
Chapter 1
(syntax).
IPS!
T
Think program as a recipe which contains a list of ingredients &
a list of direction.
.
e.g
a word processor is a program written in computer language like C,
that tells the computer what to do when you type in a letter.
ZEDZ@PSIS
www.company.com
COMPILING & BUILDING?
C
• Compiling is the act of turning source
code into object code.
Chapter 1
• Linking is the act of combining object
code with libraries into a raw executable
program .
ZEDZ@PSIS
www.company.com
UNDERSTANDING BUILDING PROCESS
C Remove comments
Source code (.c file)
Include header files
Replace macro with Preprocessor
Compiling Process
code
Chapter 1 Compiler
Generate assembly code (.s file)
Building Process
Assembly Code
Assembler
Generate object code (.obj file)
Linking Process
Linker
Generate executable file (.exe file)
Components of
compiler
Executable file
ZEDZ@PSIS
www.company.com
PROGRAMMER ?
C
• A programmer is a person who designs,
writes & test computer programs.
Chapter 1
ZEDZ@PSIS
www.company.com
STRUCTURED PROGRAMMING
C
•
TYPES OF PROGRAMMING
ZEDZ@PSIS
www.company.com
MODULAR PROGRAMMING
C
•
TYPES OF PROGRAMMING
ZEDZ@PSIS
www.company.com
OBJECT ORIENTED PROGRAMMING
C
•
TYPES OF PROGRAMMING
ZEDZ@PSIS
www.company.com
WHAT IS AN IDE?
C
Chapter 1
editor
compiler
IPS!
T
Development tools that combine both editor and compiler is
called development Integrated Development Environment , IDE.
www.company.com
SAMPLE OF C PROGRAM
C
Chapter 1
ZEDZ@PSIS
www.company.com
CREATING YOUR 1st C PROGRAM
C
ZEDZ@PSIS
www.company.com