You are on page 1of 6

Table of Contents

Course Guide Topic 1: Introduction to Programming 1.1 Introduction and Definitions 1.2 Program Development Process 1.2.1 Problem Solving Phase 1.2.2 Implementation Phase Summary Key Terms Algorithm 2.1 Algorithms Representation 2.1.1 Flow Chart Representation 2.1.2 Pseudo-Code Representation 2.2 Algorithm Development Method 2.2.1 Identify Input and Output of Problems 2.2.2 Identifying Sub-problem 2.2.3 Solving Sub-problems 2.3 Selection Structure 2.3.1 Single Selection 2.3.2 Dual Selection 2.3.3 Multi-Selection 2.4 Repetition Structure 2.4.1 Counter Controlled Loop 2.4.2 Condition Controlled Loop 2.4.3 Sentry Controlled Loop 2.4.4 Structuring Summary Key Terms Programming Language 3.1 Programming Language Types 3.1.1 Machine Language 3.1.2 Assembly Language 3.1.3 High Level Language 3.2 C Language xi xvi 1 2 3 3 4 6 6 7 8 8 9 11 12 13 14 16 16 20 24 28 29 33 36 38 42 42 43 44 44 44 44 46

Topic 2:

Topic 3:

iv

X TABLE OF CONTENTS

3.3 C Programming Environment 3.4 Sample C Program Summary Key Terms Topic 4: Variables 4.1 Variable Naming 4.1.1 Rules to Name a Variable 4.1.2 C Reserved Words and Standard Identifiers 4.2 Variable Types 4.3 Variable Declarations 4.4 Variable Assignment Summary Key Terms Data Types 5.1 Cell Sizes and Qualifiers 5.2 Integer Data Type (int) 5.3 Character Data Type (char) 5.4 Real Data Type Summary Key Terms Constants 6.1 Integer Constant 6.2 Real Constants 6.3 Character Constant 6.4 String Constant Summary Key Terms Input and Output 7.1 printf () function 7.1.1 Printing Strings 7.1.2 Printing Values scanf() function 7.2 7.2.1 Variable Input Summary Key Terms

47 49 51 52 53 53 54 55 56 56 58 59 60 61 61 62 62 63 64 65 66 66 67 69 70 71 72 73 74 74 76 80 81 83 83

Topic 5:

Topic 6:

Topic 7:

TABLE OF CONTENTS W

Topic 8:

Operators and Expressions 8.1 Basic Arithmetic Operators 8.2 Arithmetic Expressions 8.2.1 Precedence Level 8.2.2 Writing Arithmetic Expressions in C 8.3 Assignment Statement ( = ) 8.3.1 Expression Assignment Statement 8.3.2 Multiple Expression Assignment Statement 8.3.3 Compound Assignment Statement 8.4 Relational Operator 8.5 Logical Operator 8.6 Increment and Decrement Operator 8.7 Cast Operator 8.8 Conditional Operator Summary Key Terms Selection Control Structure if Statement 9.1 switch and break Statement 9.2 Summary Key Terms Case Study 10.1 Problem Statement 10.2 Analysis 10.3 Data Requirements 10.4 Design 10.5 Implementation Summary Key Terms Repetition 11.1 for Statement 11.2 while Statement 11.2.1 The Relationship between while and for Statements 11.2.2 Integer Expression and Loop Initialisation 11.2.3 Endless Loop 11.2.4 while Loop Controlled by Condition 11.2.5 while Loop Controlled by Sentry

84 84 88 88 90 91 91 92 94 95 96 98 101 102 104 104 105 106 111 115 115 116 116 117 118 119 121 124 124 125 125 129 131 132 133 133 135

Topic 9:

Topic 10:

Topic 11:

vi

X TABLE OF CONTENTS

11.3 11.4

do-while Statement continue Statement 11.4.1 continue Flow Control Statement 11.5 break Statement 11.5.1 break Control Flow Statement 11.6 Nested Loops 11.6.1 Tracing Nested Loops Summary Key Terms Functions 12.1 What is Function? 12.2 Calling a Function 12.2.1 Calling a Function without Parameter 12.2.2 Calling a Function with Parameters 12.2.3 C Standard Library 12.3 Writing a Function 12.3.1 Writing a Function without Parameter 12.3.2 Writing a Functions with Parameters 12.3.3 Returning Values 12.3.4 Variable Scope 12.3.5 Function Prototype 12.4 Recursion 12.5 Functions and Top Down Design Summary Key Terms File Manipulations 13.1 File Support in C 13.1.1 File Format Types 13.1.2 File Access Types 13.2 File Operations 13.2.1 fopen() 13.2.2 fclose() 13.2.3 fprintf() 13.2.4 fscanf() 13.2.5 getc() 13.2.6 putc() Summary Key Terms

136 137 138 139 139 141 141 144 144 145 146 146 147 148 149 150 151 153 154 157 164 167 172 175 175 176 176 177 177 178 178 180 181 182 184 185 188 188

Topic 12:

Topic 13:

TABLE OF CONTENTS W vii

Topic 14:

Case Study 14.1 Menu-Driven Program 14.1.1 Problem 14.1.2 Analysis 14.1.3 Design 14.1.4 Implementation Summary Key Terms

189 189 189 190 190 192 194 194

viii X TABLE OF CONTENTS

You might also like