■ Indexfprintf function, 111–112Fractionsinteger values, 293manipulation, 294printFraction, 293write functions, 294–295fscanf function, 108Functions, 165, 304classification number, 186–187data processing, 169double value, 185factorial (see Factorial function)getchar and getc, 165header, 168–169highest common factor, 165highest common factor (HCF), 175–178if…else statements, 173–175main statement, 165max variable, 170–172net pay calculation, 185program, 167–168prototype, 168skipLines, 166sum of exact divisors, 186• GgetLargest function, 300getString and readChar function, 286getString function, 228–229• HHighest common factor (HCF)do…while statement, 133–134function, 175lowest common multiple (LCM), 177–178printf statement, 176prototype, 177repetition logic program, 96–97scanf, 176• I, J, Kif statementassignment statements, 71boundary case, 73condition, 69construct, 70C program, 69–70indent, 71integer, 73program, 69, 74–75pseudocode, 69, 71style matches, 72sum of, 72temporary variable, 71if…else statementcalculate pay, 77–79selection logic programs, 75–77Increment and decrement operators, 100Infinite loop, 157initialize function, 297Insertion sortanalysis of, 258array, 252ascending order, 253element, 259insertionSort function, 257–258method description, 253proceeds, 253–256while statement, 256Integer value, 142Interactive, 106• LLogical operatorsAND (&&), 66–67NOT (!), 68OR (||), 67Lowest common multiple (LCM), 177–178• MManifest constants. See Symbolic constantsmax functionheader, 171printf statement, 172return statement, 171returns values, 172user types, 171variables, 170Merging processimplementation, 273–275logic expression, 273ordered lists, 271–273Multiplication tablesdefensive programming, 129output results, 125printf statement, 126, 128program running, 127validation, 129309www.it-ebooks.info
■ index• N, ONamed constants. See Symbolic constantsNested structuredeclaration, 292Student structure, 292while condition, 292Null character, 142• P, QParallel arrays, 262C structure, 264integer array, 262parallelSort, 263sorting process, 263PersonData and VoteCount function, 299printDate statement, 282printf statement, 42printFraction function, 293printResults function, 299–302processVotes function, 298Programming conceptsalgorithm (see Algorithm)analyze problem, 4assembly language, 2characters, 11comments, 17compiler, 3computer memory, 9data types, 10declare variables, 19define problem, 3document program, 9final point, 20high-level or problem-orientedlanguages, 2low-level programminglanguage, 2machine language, 2maintenance programmer, 9outputescape sequence, 16format string, 17newline character, 15printf statement, 14string constant, 16program, 1test and debug program, 8using algorithm, 6putc function, 157• RRead and print charactersch statement, 145code execute, 149–150EOF, 145getchar keyword, 145int variable, 145non-blank character, 148printf and getchar returns, 147program running, 149scanf keyword, 145single character, 145while condition, 150–151while statement, 149Read characters, 156–157Read, search and sort structuresescape sequence, 288–290getString, 288input.txt, 291program, 288readChar, 288Relational operators, 66Repetition logic programassignment operator, 101–102countfind average, 99integer variable, 97program modification, 97sequences, 98description, 91do…while statement, 132–135for construct (see for statement)increment and decrement operators, 100largest number typealgorithm, 102–103data entering, 103–104program running, 102steps, 102while loop, 103largest number typed, 102multiplication tables, 125–128payroll systemnon-whitespace character, 114payroll.txt file, 112program and comments, 115–117sample data, 113scanf/fscanf, 114string concatenation, 114strcat, 114strcmp, 115310www.it-ebooks.info
- Page 1 and 2:
THE EXPERT’S VOICE® IN PROGRAMMI
- Page 3 and 4:
Learn to Program with CCopyright ©
- Page 5 and 6:
Contents at a GlanceAbout the Autho
- Page 7 and 8:
■ Contents1.7 Write Output with p
- Page 9 and 10:
■ Contents■Chapter ■ 5: Progr
- Page 11 and 12:
■ Contentsxii7.11 Some Character
- Page 13 and 14:
About the AuthorDr. Noel Kalicharan
- Page 15 and 16:
AcknowledgementsI would like to exp
- Page 17 and 18:
■ PrefaceOf course, you must lear
- Page 19 and 20:
Chapter 1 ■ Elementary Programmin
- Page 21 and 22:
Chapter 1 ■ Elementary Programmin
- Page 23 and 24:
Chapter 1 ■ Elementary Programmin
- Page 25 and 26:
Chapter 1 ■ Elementary Programmin
- Page 27 and 28:
Chapter 1 ■ Elementary Programmin
- Page 29 and 30:
Chapter 1 ■ Elementary Programmin
- Page 31 and 32:
Chapter 1 ■ Elementary Programmin
- Page 33 and 34:
Chapter 1 ■ Elementary Programmin
- Page 35 and 36:
Chapter 1 ■ Elementary Programmin
- Page 37 and 38:
Chapter 1 ■ Elementary Programmin
- Page 39 and 40:
Chapter 2C - The BasicsIn this chap
- Page 41 and 42:
Chapter 2 ■ C - The Basicstokenin
- Page 43 and 44:
2.3.2 Reserved WordsChapter 2 ■ C
- Page 45 and 46:
2.5 Integer Numbers - intChapter 2
- Page 47 and 48:
Chapter 2 ■ C - The Basicsis eval
- Page 49 and 50:
Chapter 2 ■ C - The BasicsEach nu
- Page 51 and 52:
Chapter 2 ■ C - The Basics6 says
- Page 53 and 54:
Chapter 2 ■ C - The BasicsIf op1
- Page 55 and 56:
Chapter 2 ■ C - The BasicsThe val
- Page 57 and 58:
2.8 The Assignment StatementChapter
- Page 59 and 60:
Chapter 2 ■ C - The BasicsExercis
- Page 61 and 62:
Chapter 2 ■ C - The Basics30. Wha
- Page 63 and 64:
Chapter 3 ■ Programs with Sequenc
- Page 65 and 66:
Chapter 3 ■ Programs with Sequenc
- Page 67 and 68:
Chapter 3 ■ Programs with Sequenc
- Page 69 and 70:
Chapter 3 ■ Programs with Sequenc
- Page 71 and 72:
Chapter 3 ■ Programs with Sequenc
- Page 73 and 74:
Chapter 3 ■ Programs with Sequenc
- Page 75 and 76:
Chapter 3 ■ Programs with Sequenc
- Page 77 and 78:
Chapter 3 ■ Programs with Sequenc
- Page 79 and 80:
Chapter 4Programs with Selection Lo
- Page 81 and 82:
Chapter 4 ■ Programs with Selecti
- Page 83 and 84:
Chapter 4 ■ Programs with Selecti
- Page 85 and 86:
Chapter 4 ■ Programs with Selecti
- Page 87 and 88:
Chapter 4 ■ Programs with Selecti
- Page 89 and 90:
Chapter 4 ■ Programs with Selecti
- Page 91 and 92:
Chapter 4 ■ Programs with Selecti
- Page 93 and 94:
Chapter 4 ■ Programs with Selecti
- Page 95 and 96:
Chapter 4 ■ Programs with Selecti
- Page 97 and 98:
Chapter 4 ■ Programs with Selecti
- Page 99 and 100:
Chapter 4 ■ Programs with Selecti
- Page 101 and 102:
Chapter 4 ■ Programs with Selecti
- Page 103 and 104:
Chapter 4 ■ Programs with Selecti
- Page 105 and 106:
Chapter 5 ■ Programs with Repetit
- Page 107 and 108:
Chapter 5 ■ Programs with Repetit
- Page 109 and 110:
Chapter 5 ■ Programs with Repetit
- Page 111 and 112:
Chapter 5 ■ Programs with Repetit
- Page 113 and 114:
Chapter 5 ■ Programs with Repetit
- Page 115 and 116:
Chapter 5 ■ Programs with Repetit
- Page 117 and 118:
Chapter 5 ■ Programs with Repetit
- Page 119 and 120:
Chapter 5 ■ Programs with Repetit
- Page 121 and 122:
Chapter 5 ■ Programs with Repetit
- Page 123 and 124:
Chapter 5 ■ Programs with Repetit
- Page 125 and 126:
Chapter 5 ■ Programs with Repetit
- Page 127 and 128:
Chapter 5 ■ Programs with Repetit
- Page 129 and 130:
Chapter 5 ■ Programs with Repetit
- Page 131 and 132:
Chapter 5 ■ Programs with Repetit
- Page 133 and 134:
Chapter 5 ■ Programs with Repetit
- Page 135 and 136:
Chapter 5 ■ Programs with Repetit
- Page 137 and 138:
Chapter 5 ■ Programs with Repetit
- Page 139 and 140:
Chapter 5 ■ Programs with Repetit
- Page 141 and 142:
Chapter 5 ■ Programs with Repetit
- Page 143 and 144:
Chapter 5 ■ Programs with Repetit
- Page 145 and 146:
Chapter 5 ■ Programs with Repetit
- Page 147 and 148:
Chapter 5 ■ Programs with Repetit
- Page 149 and 150:
Chapter 5 ■ Programs with Repetit
- Page 151 and 152:
Chapter 5 ■ Programs with Repetit
- Page 153 and 154:
Chapter 5 ■ Programs with Repetit
- Page 155 and 156:
Chapter 6 ■ CharactersThe ASCII c
- Page 157 and 158:
Chapter 6 ■ CharactersIn this cas
- Page 159 and 160:
Chapter 6 ■ CharactersHThis would
- Page 161 and 162:
Chapter 6 ■ CharactersProgram P6.
- Page 163 and 164:
Chapter 6 ■ Characters6. The whil
- Page 165 and 166:
Chapter 6 ■ Characters6.6 Count C
- Page 167 and 168:
Chapter 6 ■ Charactersnumber of c
- Page 169 and 170:
Chapter 6 ■ Characters6.9 Read Ch
- Page 171 and 172:
Chapter 6 ■ CharactersThis proble
- Page 173 and 174:
Chapter 6 ■ CharactersTo get arou
- Page 175 and 176:
Chapter 6 ■ CharactersThe sequenc
- Page 177 and 178:
Chapter 6 ■ Characters11. Write a
- Page 179 and 180:
Chapter 7 ■ Functions7.2 skipLine
- Page 181 and 182:
Chapter 7 ■ FunctionsWhen we wish
- Page 183 and 184:
Chapter 7 ■ FunctionsIf, when a f
- Page 185 and 186:
Chapter 7 ■ FunctionsIn order to
- Page 187 and 188:
Chapter 7 ■ Functionsessentially
- Page 189 and 190:
Chapter 7 ■ FunctionsThe logic fo
- Page 191 and 192:
Chapter 7 ■ FunctionsSince lcm us
- Page 193 and 194:
Chapter 7 ■ Functions• The logi
- Page 195 and 196:
Chapter 7 ■ FunctionsWhen main is
- Page 197 and 198:
Chapter 7 ■ Functionsint factoria
- Page 199 and 200:
Chapter 7 ■ Functions7.10 Sum of
- Page 201 and 202:
Chapter 7 ■ Functions7.11 Some Ch
- Page 203 and 204:
Chapter 7 ■ Functionsint isLowerC
- Page 205 and 206:
Chapter 7 ■ FunctionsThis fetches
- Page 207 and 208:
Chapter 7 ■ Functions8. Write a f
- Page 209 and 210:
Chapter 8ArraysIn this chapter, we
- Page 211 and 212:
Chapter 8 ■ ArraysIn our example,
- Page 213 and 214:
Chapter 8 ■ ArraysIf we wish to p
- Page 215 and 216:
8.3.1 About Not Using Element 0Chap
- Page 217 and 218:
Chapter 8 ■ ArraysPoints to note
- Page 219 and 220:
Chapter 8 ■ ArraysThe complete pr
- Page 221 and 222:
Chapter 8 ■ ArraysThis prints a l
- Page 223 and 224:
Chapter 8 ■ ArraysYou can change
- Page 225 and 226:
Chapter 8 ■ ArraysTo use the func
- Page 227 and 228:
Chapter 8 ■ ArraysThe length of a
- Page 229 and 230:
Chapter 8 ■ ArraysIn printf, the
- Page 231 and 232:
Chapter 8 ■ ArraysSwapping two ch
- Page 233 and 234:
Chapter 8 ■ ArraysIf all the lett
- Page 235 and 236:
Chapter 8 ■ Arraysshe does this,
- Page 237 and 238:
Chapter 8 ■ Arrays} //end letters
- Page 239 and 240:
Chapter 8 ■ ArraysFigure 8-3. The
- Page 241 and 242:
Chapter 8 ■ ArraysSuppose we have
- Page 243 and 244:
Chapter 8 ■ ArraysSuppose a count
- Page 245 and 246:
Chapter 8 ■ Arraysdelim = ch;whil
- Page 247 and 248:
Chapter 8 ■ ArraysHere is the fun
- Page 249 and 250:
Chapter 8 ■ ArraysBut what kind o
- Page 251 and 252:
Chapter 8 ■ ArraysThis is a cleve
- Page 253 and 254:
Chapter 8 ■ Arraysfprintf(out, "\
- Page 255 and 256:
Chapter 9Searching, Sorting, and Me
- Page 257 and 258:
Chapter 9 ■ Searching, Sorting, a
- Page 259 and 260:
Chapter 9 ■ Searching, Sorting, a
- Page 261 and 262:
Chapter 9 ■ Searching, Sorting, a
- Page 263 and 264:
Chapter 9 ■ Searching, Sorting, a
- Page 265 and 266:
Chapter 9 ■ Searching, Sorting, a
- Page 267 and 268:
Chapter 9 ■ Searching, Sorting, a
- Page 269 and 270: Chapter 9 ■ Searching, Sorting, a
- Page 271 and 272: 9.3.2 Insert an Element in PlaceCha
- Page 273 and 274: Chapter 9 ■ Searching, Sorting, a
- Page 275 and 276: Chapter 9 ■ Searching, Sorting, a
- Page 277 and 278: Chapter 9 ■ Searching, Sorting, a
- Page 279 and 280: Chapter 9 ■ Searching, Sorting, a
- Page 281 and 282: Chapter 9 ■ Searching, Sorting, a
- Page 283 and 284: Chapter 9 ■ Searching, Sorting, a
- Page 285 and 286: Chapter 9 ■ Searching, Sorting, a
- Page 287 and 288: Chapter 9 ■ Searching, Sorting, a
- Page 289 and 290: Chapter 9 ■ Searching, Sorting, a
- Page 291 and 292: Chapter 10 ■ StructuresThe proble
- Page 293 and 294: Chapter 10 ■ StructuresFor this e
- Page 295 and 296: Chapter 10 ■ StructuresSince ther
- Page 297 and 298: Chapter 10 ■ Structures286Suppose
- Page 299 and 300: Chapter 10 ■ StructuresWe could e
- Page 301 and 302: Chapter 10 ■ Structuresint n = 0;
- Page 303 and 304: Chapter 10 ■ Structures10.7 Neste
- Page 305 and 306: Chapter 10 ■ Structuresint main()
- Page 307 and 308: Chapter 10 ■ Structures296A file,
- Page 309 and 310: Chapter 10 ■ Structureselseprint
- Page 311 and 312: Chapter 10 ■ StructuresTo find th
- Page 313 and 314: Chapter 10 ■ StructuresVoteCount
- Page 315 and 316: Chapter 10 ■ Structureswhile (k >
- Page 317 and 318: Chapter 10 ■ Structures6. A file
- Page 319: ■ index• CCharactersarithmetic
- Page 323: ■ indexStrings (cont.)for stateme