Topic 1: Introduction to C Programming

+3

No comments posted yet

Comments

Slide 1

Introduction to C Programming MOHD ZEID ABU BAKAR ELECTRICAL ENGINEERING DEPARTMENT SULTAN IDRISSHAH POLYTECHNIC C Chapter 1 EC201

Slide 2

At the end of lesson, students should be able : OBJECTIVES Chapter 1 C To define what is C & its basic elements To define what is program & environment To discuss steps in programming To understand components of program structure. ZEDZ@PSIS

Slide 3

PROGRAMMING LANGUAGE ? Chapter 1 C ZEDZ@PSIS

Slide 4

Artificial language that can be used to control the behaviour & properties of a computer. THE PROGRAMMING LANGUAGE Chapter 1 C ZEDZ@PSIS - Applications - Server - Utilities - System Programs PROGRAMMING LANGUAGES USAGE - Low Level Language @ Machine Language - Assembly Language - High Level Language TYPES OF LANGUAGES

Slide 5

Low Level Languages: Easily understood by computers Difficult to understand by humans Assembly Languages: Similar to the machine language The machine language contains numerical information while the assembly language has characters. High Level Languages: Used to develop complex applications Closer to human languages & easier to be understood. THE PROGRAMMING LANGUAGE Chapter 1 C ZEDZ@PSIS

Slide 6

THE PROGRAMMING LANGUAGE Chapter 1 C ZEDZ@PSIS

Slide 7

THE PROGRAMMING LANGUAGE Chapter 1 C ZEDZ@PSIS BASIC: Beginners All-purpose Symbolic Instruction Code. 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.

Slide 8

THE PROGRAMMING LANGUAGE Chapter 1 C ZEDZ@PSIS Pascal: A structured general purpose language designed primarily for teaching programming. 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.

Slide 9

THE PROGRAMMING LANGUAGE Chapter 1 C ZEDZ@PSIS Java: An object-oriented language invented at Sun Microsystem. Used to develop web based programs . Visual Basic: A Microsoft programming language & software development environment . Allows programmer to quickly create Windows based application.

Slide 10

A high level structured & procedural programming language. C is an intermediate language between human & computer. C is much closer to assembly language & is used to write UNIX based OS. WHAT IS C ? Chapter 1 C Human Language Machine Language ZEDZ@PSIS

Slide 11

Semantics Vocabulary of commands that human can understand and can be converted into machine language. Syntax Language structure (grammar) . BASIC ELEMENTS OF C Chapter 1 C Think semantics as the building blocks of your C program and the syntax as the correct way to put them together. TIPS! ZEDZ@PSIS

Slide 12

Definitions An organized set of instructions that tells the computer what to do. WHAT IS A PROGRAM ? Chapter 1 C 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. e.g. ZEDZ@PSIS Think program as a recipe which contains a list of ingredients & a list of direction. TIPS!

Slide 13

Is a text file (source file) containing sequence of C commands (semantics) put together according to the C grammar (syntax). WHAT IS A PROGRAM ? Chapter 1 C The act of creating an executable program from C is called compiling or building. TIPS! ZEDZ@PSIS

Slide 14

WHAT IS A PROGRAM ? Chapter 1 C A C source file carries the extension .C and the resulting machine executable files carry the extension .EXE .C extension .EXE extension C compiler ZEDZ@PSIS

Slide 15

PROGRAMMER ? Chapter 1 C A programmer is a person who designs, writes & test computer programs. ZEDZ@PSIS

Slide 16

STRUCTURED PROGRAMMING Chapter 1 C ZEDZ@PSIS Structured programming takes on the top to bottom approach. It splits the tasks into modular forms which makes the program simpler with less codes & easier to read.

Slide 17

OBJECT ORIENTED PROGRAMMING Chapter 1 C ZEDZ@PSIS OOP splits the program into objects that can be reused into other programs. Each function is developed to instruct an object to perform actions based on the event that take place.

Slide 18

WHAT IS AN ENVIRONMENT ? Chapter 1 C Development tools that combine both editor and compiler is called development environment. TIPS! compiler editor

Slide 19

STEPS IN PROGRAMMING Define & analyze problems C Step 1 Step 2 Step 3 Chapter 1 Plan variables Draw flowchart Step 4 Write program Step 5 Test & debug program Step 6 Document program ZEDZ@PSIS

Slide 20

STEPS IN PROGRAMMING Define & analyze problems C Step 1 Chapter 1 Clearly define the problem & determine ways of resolving it. Identify & understand what are the problem to resolve. Analyzing the problem will determine the input, output and information required to solve it. Input – data to be processed Output – desired results TIPS! INPUT OUTPUT PROCESS

Slide 21

STEPS IN PROGRAMMING Planning of variables C Step 2 Chapter 1 Variables are simply references to memory locations. A well plan use of variables will produce an efficient execution of program in term of speed and memory allocation. e.g.! ZEDZ@PSIS

Slide 22

STEPS IN PROGRAMMING Drawing of flowchart C Step 3 Chapter 1 Flowchart represents algorithm in graphic form comprising of geometrical symbols which is interrelated by line of flow. ZEDZ@PSIS

Slide 23

STEPS IN PROGRAMMING Writing of program C Step 4 Chapter 1 Program should be written as simple as possible. The main objective is to give a clear, readable programs through an orderly and disciplined approach to programming. ZEDZ@PSIS

Slide 24

STEPS IN PROGRAMMING Testing & debugging C Step 5 Chapter 1 The presence of errors will be apparent when the written program is compiled & executed. Usually it were the syntax, semantics and execution errors. This type of errors is quite easy to find & corrected (debug). Logical errors however is difficult to detect since the output from the logically incorrect program may appear to be error free. ZEDZ@PSIS

Slide 25

STEPS IN PROGRAMMING Documentation C Step 6 Chapter 1 Program must be documented for future reference and maintenance. A properly & well documented program will make it easier for the original programmer or other programmer to follow the program logic and design. ZEDZ@PSIS

Slide 26

STEPS IN PROGRAMMING Documentation C Step 6 Chapter 1 Documentation should consist: Accurate specification of requirement Detail input, output, constraint and formula Algorithm in the form of flowchart or pseudo code Program source complete with comments Sample program which had been run, executed and tested Guideline @ manual on how to use the program. ZEDZ@PSIS

Slide 27

MAKING COMMENTS C Chapter 1 ZEDZ@PSIS

Slide 28

CREATING YOUR 1st C PROGRAM Entering the C code C Building the program Executing the program Step 1 Step 2 Step 3 Chapter 1 ZEDZ@PSIS

Summary: Introduction to C Programming - C definition & basic elements of C - Program, programmer & environment - Steps in programming - Components of program structure

Tags: c program programmer environment programming steps

URL:
More by this User
Most Viewed