■ Indexvariables adding, 117–118whitespace character, 114read data filedata pointer, 107file pointer, 107find average numbers, 108, 110fopen function, 107fscanf, 108input.txt, 107interactive, 106standard input, 107send output filefile pointer, 110fprintf, 111–112smallest number typealgorithm, 105–106steps, 105temperature conversiontable, 129, 131while constructalgorithm, 93–94highest common factor, 96–97printf statement, 95–96program, 91program looping, 94pseudocode, 93sentinel value, 92sum of, 93while loop, 92• SSelection logic programsboolean expressions, 65if construct, 69–72, 74–75if…else construct, 75, 77–80print letter grade, 83–84program testing, 80sequence logic program, 65symbolic constants, 80–82triangle, 85, 87Selection sort. See Sorting processSentinel value, 92Sequence logicaverage program, 55banking problem, 57grounds tickets, 60printf and scanf statement, 49reserved tickets, 60scanf statementdouble variable, 52float variable, 52format string, 51whitespace, 52square program, 56stand tickets, 60string value, 54sum, 48variable declaration, 47Sequential searcharrays, 244integer array, 243keys, 244name array, 245string function, 245technique, 243voting problem, 245Simple vs. array variables, 197skipLines function, 166call arguments, 167data processing, 169declarations, 169definition, 166function prototype, 168header, 168header and parameter, 166integer argument, 166integer value, 168printf statement, 166program, 167sortByName function, 303Sorting processalgorithm, 248analysis of, 252array (see Array of strings)ascending/descending order, 246, 251character and integer array, 248insertion sort (see Insertion sort)meaning, 246observation, 250portion, 249proceeds, 246, 248program requests, 249–250while condition, 251Straight-line logic. See Sequence logicstrcmp function, 115, 165Strings, 38character arrayargument, 219code project, 215311www.it-ebooks.info
■ indexStrings (cont.)for statement, 218numSpaces, 216properly terminating, 214relational operators, 214reverse function, 219–220str, 217while loop, 216getString function, 228–229length of, 215name of daynameOfDay, 225printDay, 225two-dimensional array, 226–227values, 227null string, 214printf, 216stored format, 213strcmp function, 214strlen function, 215while loop, 217struct keyword, 280Structuresapproaches, 279array of, 285–287declaration, 280–282fractions, 293–295functions, 304member operator, 281need for, 279nested structure, 292–293process data, 279read, search and sort, 288–291typedef, 283–284voting problem, 295–302, 304Symbolic constants#define directive, 81–82definition, 80–81MaxRegularHours, 82OvertimeFactor, 82program illustration, 81• T, UTemperature conversion table, 129, 131Triangle classification, 85–86typedefDate structure, 283declare variables, 285dob structure, 284int type, 283printDate keyword, 284structure variables, 283Whole keyword, 283• VValue, 142Variable-lengtharrays (VLAs), 260–262Voting problem of structuresarray and simple-variablearguments, 295C structures, 296descending order, 303getLargest, 300initialize function, 297numVotes function, 303PersonData and VoteCountfunction, 299printResults, 299–302processVotes, 298results.txt, 296sortByName function, 303structure declarations, 298symbolic constants, 297votes.txt, 296• W, X, Y, Zwhile condition, 150–151while statement, 149Word frequency countadvantage, 267approach, 267–270outline development, 266possibilities, 266search and insert, 266sequences, 270–271Write charactersdeclaration, 157echo input andnumber lines, 157–161putc function, 157312www.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 and 320: ■ index• CCharactersarithmetic
- Page 321: ■ index• N, ONamed constants.