ISBN13: 9781565923065 ISBN10: 1565923065 All Product Details
[ Symbols and Numbers ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ Y ], [ Z ], [_IX-1_] [_IX-1_] [_IX-1_] [_IX-1_] Symbols and Numbers[ Top ] & (address of operator), 185 & (and operator), 158, 185 & vs. &&, 159 x operator (dereference), 185 != operator (not equal), 85 ^ (exclusive or), 158, 161 , operator (comma), 85, 346 {} (curly braces), 85 " (double quote), 60 -- operator (decrement), 78 = versus ==, 10, 91 == operator (equal), 85, 105, 382 < (left="" shift),="" 158,="" 162="">> operator (greater than), 85 -> operator (structure pointer), 287 >= operator (greater than or equal to), 85 >> (right shift), 158, 162 ++ operator (increment), 78 += operator (increase), 79 ' (single quotes), 60 ~ (complement operator), 158, 161 | (or operator), 158, 160 [_IX-1_] 0 character, 64 A[ Top ] abstract class, 356 accuracy, floating point, 269, 270 addition operator (+), 51 addition, floating point, 266 address of operator (&), 185 alignment restrictions, 339 ambiguous code, 86 and operator (&), 158 and portability, 338 argc, 201 argv, 201 array declarations, 7 arrays, 63, 181 dimension of, 63 elements of, 63 index, 64 infinite, 310, 313, 316 initializing, 73 multi-dimensional, 74 and pointers, 189, 191 of structures, 181 ASCII characters, 60 files, 215-216 assembly language, 5 assignment statements, 8, 382 author, 40 auto, 130 automatic parameter changes, 194 automatic variables, 130 B[ Top ] binary files, 215-216, 338 I/O, 218 mode for fopen (b), 216 trees, 292 bit fields, 179, 181 bit operations, 156 bit operators, 158 bitmapped graphics, 166, 167 bits, 54, 156, 163-164 bitwise and (&), 158 bitwise complement (~), 158, 161 bitwise exclusive or (^), 158, 161 bitwise left shift (<), 158="">bitwise or (|), 158, 160 bitwise right shift (>>), 158, 162 bitwise shift left (<), 162="">blank modifier, 306 boolean algebra, 156 bottom-up programming, 136 Bourne shell, 142 branching statements, 84 break statement, 89, 118, 121 breakpoints, 253 buffered file problems, 219 bytes, 156, 338 C[ Top ] %c conversion, 60 C language, 6 C tools, 107 C++ language, 7, 9 Calc (program), 98, 100, 120 calculation operators, 51 call graphs, 108 carriage return, 216 case labels, 119 case statement, 118-119 cb program, 108 cc command, 140, 144, 148 cd command, 97 cdb debugger, 240 cflow program, 108 char, 60 character type, 354 characters, 60 as integers, 76 chess, data structures for, 300 classes, ii, 129 abstract, 356 derived, 356 pure virtual functions, 356 variable, 127 clearing bits, 163 close, 222 COBOL, 6 code coding, 355 commenting out, 148 design, 96, 98, 349 format, 45, 48 maintaining, 38 source, 11 command-line arguments, 201 commands, 240 comments, 9, 39, 148 author, 40 boxes, 40, 43 in data files, 225 file formats, 42 functions, 130 heading, 40, 42, 50 notes, 42 procedures, 130 program, 109 purpose, 40 references, 42 restrictions, 42 revision history, 42 units, 44 compile command, 148 compilers, 7, 14, 324 conditional, 146 complement (~), 158, 161 complex data types, 7 computation operators, 51 concatenating strings, 66 conditional clause, 84 conditionals, 382 const statement, 77, 145 const pointers, 189 continue statement, 90, 123 control flow, 84 control statements, 8 control variables, 116 conversion routines, 212 cpp program, 144 cprint printer, 108 CR (carriage return), 216 cross-reference programs, 107 ctype.h, 296 curly braces, 85 and arrays, 73 D[ Top ] %d conversion, 56 data declarations, 7, 49 data types, enumerated, 178 dbx debugger, 240 -DDEBUG, 238 debug statement, 147 debugging, 9, 38, 97, 104, 264 binary search, 244 breakpoints, 253 with cdb, 240 command-line switch, 238 conditional compilation, 238 with dbx, 240 divide and conquer method, 237 interactive, 240 going through output, 239 save file, 232 with sdb, 240 decimal point, 57 decision statements, ii declarations, 42, 49 array, 7 data, 7 integer, 54 pointer, 184 structures, 7 variable, 52, 53 default statement, 118, 383 #define statement, 140-141 vs. const, 145 defining bit values, 163 dereference operator (x), 185 derived class, 356 diagnostic printf, 105 dimensions, array, 63 directories, 97 divide by 0 error, 254 divide operator (/), 51, 58 division, floating point, 268 do/while statement, 344 documents, government, 4 DOS Makefile, 316 double data type, 271, 272 double-linked list, 288, 290 double quotes, 60, 65 dynamic data structures, 279 E[ Top ] elements, 63, 173 else statement, 85, 147 Emacs editor, 43 #endif statement, 147 English language, 4 enum (enumerated) data types, 178 EOF (end of file) character, 210 escape character, 60 Evaluation order problems, 79 EVEN macro, 160 exclusive or (^), 158, 161 executable program, 11 executable statements, 51 extern, 306, 308 F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
Symbols and Numbers[ Top ] & (address of operator), 185 & (and operator), 158, 185 & vs. &&, 159 x operator (dereference), 185 != operator (not equal), 85 ^ (exclusive or), 158, 161 , operator (comma), 85, 346 {} (curly braces), 85 " (double quote), 60 -- operator (decrement), 78 = versus ==, 10, 91 == operator (equal), 85, 105, 382 < (left="" shift),="" 158,="" 162="">> operator (greater than), 85 -> operator (structure pointer), 287 >= operator (greater than or equal to), 85 >> (right shift), 158, 162 ++ operator (increment), 78 += operator (increase), 79 ' (single quotes), 60 ~ (complement operator), 158, 161 | (or operator), 158, 160 [_IX-1_] 0 character, 64 A[ Top ] abstract class, 356 accuracy, floating point, 269, 270 addition operator (+), 51 addition, floating point, 266 address of operator (&), 185 alignment restrictions, 339 ambiguous code, 86 and operator (&), 158 and portability, 338 argc, 201 argv, 201 array declarations, 7 arrays, 63, 181 dimension of, 63 elements of, 63 index, 64 infinite, 310, 313, 316 initializing, 73 multi-dimensional, 74 and pointers, 189, 191 of structures, 181 ASCII characters, 60 files, 215-216 assembly language, 5 assignment statements, 8, 382 author, 40 auto, 130 automatic parameter changes, 194 automatic variables, 130 B[ Top ] binary files, 215-216, 338 I/O, 218 mode for fopen (b), 216 trees, 292 bit fields, 179, 181 bit operations, 156 bit operators, 158 bitmapped graphics, 166, 167 bits, 54, 156, 163-164 bitwise and (&), 158 bitwise complement (~), 158, 161 bitwise exclusive or (^), 158, 161 bitwise left shift (<), 158="">bitwise or (|), 158, 160 bitwise right shift (>>), 158, 162 bitwise shift left (<), 162="">blank modifier, 306 boolean algebra, 156 bottom-up programming, 136 Bourne shell, 142 branching statements, 84 break statement, 89, 118, 121 breakpoints, 253 buffered file problems, 219 bytes, 156, 338 C[ Top ] %c conversion, 60 C language, 6 C tools, 107 C++ language, 7, 9 Calc (program), 98, 100, 120 calculation operators, 51 call graphs, 108 carriage return, 216 case labels, 119 case statement, 118-119 cb program, 108 cc command, 140, 144, 148 cd command, 97 cdb debugger, 240 cflow program, 108 char, 60 character type, 354 characters, 60 as integers, 76 chess, data structures for, 300 classes, ii, 129 abstract, 356 derived, 356 pure virtual functions, 356 variable, 127 clearing bits, 163 close, 222 COBOL, 6 code coding, 355 commenting out, 148 design, 96, 98, 349 format, 45, 48 maintaining, 38 source, 11 command-line arguments, 201 commands, 240 comments, 9, 39, 148 author, 40 boxes, 40, 43 in data files, 225 file formats, 42 functions, 130 heading, 40, 42, 50 notes, 42 procedures, 130 program, 109 purpose, 40 references, 42 restrictions, 42 revision history, 42 units, 44 compile command, 148 compilers, 7, 14, 324 conditional, 146 complement (~), 158, 161 complex data types, 7 computation operators, 51 concatenating strings, 66 conditional clause, 84 conditionals, 382 const statement, 77, 145 const pointers, 189 continue statement, 90, 123 control flow, 84 control statements, 8 control variables, 116 conversion routines, 212 cpp program, 144 cprint printer, 108 CR (carriage return), 216 cross-reference programs, 107 ctype.h, 296 curly braces, 85 and arrays, 73 D[ Top ] %d conversion, 56 data declarations, 7, 49 data types, enumerated, 178 dbx debugger, 240 -DDEBUG, 238 debug statement, 147 debugging, 9, 38, 97, 104, 264 binary search, 244 breakpoints, 253 with cdb, 240 command-line switch, 238 conditional compilation, 238 with dbx, 240 divide and conquer method, 237 interactive, 240 going through output, 239 save file, 232 with sdb, 240 decimal point, 57 decision statements, ii declarations, 42, 49 array, 7 data, 7 integer, 54 pointer, 184 structures, 7 variable, 52, 53 default statement, 118, 383 #define statement, 140-141 vs. const, 145 defining bit values, 163 dereference operator (x), 185 derived class, 356 diagnostic printf, 105 dimensions, array, 63 directories, 97 divide by 0 error, 254 divide operator (/), 51, 58 division, floating point, 268 do/while statement, 344 documents, government, 4 DOS Makefile, 316 double data type, 271, 272 double-linked list, 288, 290 double quotes, 60, 65 dynamic data structures, 279 E[ Top ] elements, 63, 173 else statement, 85, 147 Emacs editor, 43 #endif statement, 147 English language, 4 enum (enumerated) data types, 178 EOF (end of file) character, 210 escape character, 60 Evaluation order problems, 79 EVEN macro, 160 exclusive or (^), 158, 161 executable program, 11 executable statements, 51 extern, 306, 308 F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
A[ Top ] abstract class, 356 accuracy, floating point, 269, 270 addition operator (+), 51 addition, floating point, 266 address of operator (&), 185 alignment restrictions, 339 ambiguous code, 86 and operator (&), 158 and portability, 338 argc, 201 argv, 201 array declarations, 7 arrays, 63, 181 dimension of, 63 elements of, 63 index, 64 infinite, 310, 313, 316 initializing, 73 multi-dimensional, 74 and pointers, 189, 191 of structures, 181 ASCII characters, 60 files, 215-216 assembly language, 5 assignment statements, 8, 382 author, 40 auto, 130 automatic parameter changes, 194 automatic variables, 130 B[ Top ] binary files, 215-216, 338 I/O, 218 mode for fopen (b), 216 trees, 292 bit fields, 179, 181 bit operations, 156 bit operators, 158 bitmapped graphics, 166, 167 bits, 54, 156, 163-164 bitwise and (&), 158 bitwise complement (~), 158, 161 bitwise exclusive or (^), 158, 161 bitwise left shift (<), 158="">bitwise or (|), 158, 160 bitwise right shift (>>), 158, 162 bitwise shift left (<), 162="">blank modifier, 306 boolean algebra, 156 bottom-up programming, 136 Bourne shell, 142 branching statements, 84 break statement, 89, 118, 121 breakpoints, 253 buffered file problems, 219 bytes, 156, 338 C[ Top ] %c conversion, 60 C language, 6 C tools, 107 C++ language, 7, 9 Calc (program), 98, 100, 120 calculation operators, 51 call graphs, 108 carriage return, 216 case labels, 119 case statement, 118-119 cb program, 108 cc command, 140, 144, 148 cd command, 97 cdb debugger, 240 cflow program, 108 char, 60 character type, 354 characters, 60 as integers, 76 chess, data structures for, 300 classes, ii, 129 abstract, 356 derived, 356 pure virtual functions, 356 variable, 127 clearing bits, 163 close, 222 COBOL, 6 code coding, 355 commenting out, 148 design, 96, 98, 349 format, 45, 48 maintaining, 38 source, 11 command-line arguments, 201 commands, 240 comments, 9, 39, 148 author, 40 boxes, 40, 43 in data files, 225 file formats, 42 functions, 130 heading, 40, 42, 50 notes, 42 procedures, 130 program, 109 purpose, 40 references, 42 restrictions, 42 revision history, 42 units, 44 compile command, 148 compilers, 7, 14, 324 conditional, 146 complement (~), 158, 161 complex data types, 7 computation operators, 51 concatenating strings, 66 conditional clause, 84 conditionals, 382 const statement, 77, 145 const pointers, 189 continue statement, 90, 123 control flow, 84 control statements, 8 control variables, 116 conversion routines, 212 cpp program, 144 cprint printer, 108 CR (carriage return), 216 cross-reference programs, 107 ctype.h, 296 curly braces, 85 and arrays, 73 D[ Top ] %d conversion, 56 data declarations, 7, 49 data types, enumerated, 178 dbx debugger, 240 -DDEBUG, 238 debug statement, 147 debugging, 9, 38, 97, 104, 264 binary search, 244 breakpoints, 253 with cdb, 240 command-line switch, 238 conditional compilation, 238 with dbx, 240 divide and conquer method, 237 interactive, 240 going through output, 239 save file, 232 with sdb, 240 decimal point, 57 decision statements, ii declarations, 42, 49 array, 7 data, 7 integer, 54 pointer, 184 structures, 7 variable, 52, 53 default statement, 118, 383 #define statement, 140-141 vs. const, 145 defining bit values, 163 dereference operator (x), 185 derived class, 356 diagnostic printf, 105 dimensions, array, 63 directories, 97 divide by 0 error, 254 divide operator (/), 51, 58 division, floating point, 268 do/while statement, 344 documents, government, 4 DOS Makefile, 316 double data type, 271, 272 double-linked list, 288, 290 double quotes, 60, 65 dynamic data structures, 279 E[ Top ] elements, 63, 173 else statement, 85, 147 Emacs editor, 43 #endif statement, 147 English language, 4 enum (enumerated) data types, 178 EOF (end of file) character, 210 escape character, 60 Evaluation order problems, 79 EVEN macro, 160 exclusive or (^), 158, 161 executable program, 11 executable statements, 51 extern, 306, 308 F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
B[ Top ] binary files, 215-216, 338 I/O, 218 mode for fopen (b), 216 trees, 292 bit fields, 179, 181 bit operations, 156 bit operators, 158 bitmapped graphics, 166, 167 bits, 54, 156, 163-164 bitwise and (&), 158 bitwise complement (~), 158, 161 bitwise exclusive or (^), 158, 161 bitwise left shift (<), 158="">bitwise or (|), 158, 160 bitwise right shift (>>), 158, 162 bitwise shift left (<), 162="">blank modifier, 306 boolean algebra, 156 bottom-up programming, 136 Bourne shell, 142 branching statements, 84 break statement, 89, 118, 121 breakpoints, 253 buffered file problems, 219 bytes, 156, 338 C[ Top ] %c conversion, 60 C language, 6 C tools, 107 C++ language, 7, 9 Calc (program), 98, 100, 120 calculation operators, 51 call graphs, 108 carriage return, 216 case labels, 119 case statement, 118-119 cb program, 108 cc command, 140, 144, 148 cd command, 97 cdb debugger, 240 cflow program, 108 char, 60 character type, 354 characters, 60 as integers, 76 chess, data structures for, 300 classes, ii, 129 abstract, 356 derived, 356 pure virtual functions, 356 variable, 127 clearing bits, 163 close, 222 COBOL, 6 code coding, 355 commenting out, 148 design, 96, 98, 349 format, 45, 48 maintaining, 38 source, 11 command-line arguments, 201 commands, 240 comments, 9, 39, 148 author, 40 boxes, 40, 43 in data files, 225 file formats, 42 functions, 130 heading, 40, 42, 50 notes, 42 procedures, 130 program, 109 purpose, 40 references, 42 restrictions, 42 revision history, 42 units, 44 compile command, 148 compilers, 7, 14, 324 conditional, 146 complement (~), 158, 161 complex data types, 7 computation operators, 51 concatenating strings, 66 conditional clause, 84 conditionals, 382 const statement, 77, 145 const pointers, 189 continue statement, 90, 123 control flow, 84 control statements, 8 control variables, 116 conversion routines, 212 cpp program, 144 cprint printer, 108 CR (carriage return), 216 cross-reference programs, 107 ctype.h, 296 curly braces, 85 and arrays, 73 D[ Top ] %d conversion, 56 data declarations, 7, 49 data types, enumerated, 178 dbx debugger, 240 -DDEBUG, 238 debug statement, 147 debugging, 9, 38, 97, 104, 264 binary search, 244 breakpoints, 253 with cdb, 240 command-line switch, 238 conditional compilation, 238 with dbx, 240 divide and conquer method, 237 interactive, 240 going through output, 239 save file, 232 with sdb, 240 decimal point, 57 decision statements, ii declarations, 42, 49 array, 7 data, 7 integer, 54 pointer, 184 structures, 7 variable, 52, 53 default statement, 118, 383 #define statement, 140-141 vs. const, 145 defining bit values, 163 dereference operator (x), 185 derived class, 356 diagnostic printf, 105 dimensions, array, 63 directories, 97 divide by 0 error, 254 divide operator (/), 51, 58 division, floating point, 268 do/while statement, 344 documents, government, 4 DOS Makefile, 316 double data type, 271, 272 double-linked list, 288, 290 double quotes, 60, 65 dynamic data structures, 279 E[ Top ] elements, 63, 173 else statement, 85, 147 Emacs editor, 43 #endif statement, 147 English language, 4 enum (enumerated) data types, 178 EOF (end of file) character, 210 escape character, 60 Evaluation order problems, 79 EVEN macro, 160 exclusive or (^), 158, 161 executable program, 11 executable statements, 51 extern, 306, 308 F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
C[ Top ] %c conversion, 60 C language, 6 C tools, 107 C++ language, 7, 9 Calc (program), 98, 100, 120 calculation operators, 51 call graphs, 108 carriage return, 216 case labels, 119 case statement, 118-119 cb program, 108 cc command, 140, 144, 148 cd command, 97 cdb debugger, 240 cflow program, 108 char, 60 character type, 354 characters, 60 as integers, 76 chess, data structures for, 300 classes, ii, 129 abstract, 356 derived, 356 pure virtual functions, 356 variable, 127 clearing bits, 163 close, 222 COBOL, 6 code coding, 355 commenting out, 148 design, 96, 98, 349 format, 45, 48 maintaining, 38 source, 11 command-line arguments, 201 commands, 240 comments, 9, 39, 148 author, 40 boxes, 40, 43 in data files, 225 file formats, 42 functions, 130 heading, 40, 42, 50 notes, 42 procedures, 130 program, 109 purpose, 40 references, 42 restrictions, 42 revision history, 42 units, 44 compile command, 148 compilers, 7, 14, 324 conditional, 146 complement (~), 158, 161 complex data types, 7 computation operators, 51 concatenating strings, 66 conditional clause, 84 conditionals, 382 const statement, 77, 145 const pointers, 189 continue statement, 90, 123 control flow, 84 control statements, 8 control variables, 116 conversion routines, 212 cpp program, 144 cprint printer, 108 CR (carriage return), 216 cross-reference programs, 107 ctype.h, 296 curly braces, 85 and arrays, 73 D[ Top ] %d conversion, 56 data declarations, 7, 49 data types, enumerated, 178 dbx debugger, 240 -DDEBUG, 238 debug statement, 147 debugging, 9, 38, 97, 104, 264 binary search, 244 breakpoints, 253 with cdb, 240 command-line switch, 238 conditional compilation, 238 with dbx, 240 divide and conquer method, 237 interactive, 240 going through output, 239 save file, 232 with sdb, 240 decimal point, 57 decision statements, ii declarations, 42, 49 array, 7 data, 7 integer, 54 pointer, 184 structures, 7 variable, 52, 53 default statement, 118, 383 #define statement, 140-141 vs. const, 145 defining bit values, 163 dereference operator (x), 185 derived class, 356 diagnostic printf, 105 dimensions, array, 63 directories, 97 divide by 0 error, 254 divide operator (/), 51, 58 division, floating point, 268 do/while statement, 344 documents, government, 4 DOS Makefile, 316 double data type, 271, 272 double-linked list, 288, 290 double quotes, 60, 65 dynamic data structures, 279 E[ Top ] elements, 63, 173 else statement, 85, 147 Emacs editor, 43 #endif statement, 147 English language, 4 enum (enumerated) data types, 178 EOF (end of file) character, 210 escape character, 60 Evaluation order problems, 79 EVEN macro, 160 exclusive or (^), 158, 161 executable program, 11 executable statements, 51 extern, 306, 308 F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
D[ Top ] %d conversion, 56 data declarations, 7, 49 data types, enumerated, 178 dbx debugger, 240 -DDEBUG, 238 debug statement, 147 debugging, 9, 38, 97, 104, 264 binary search, 244 breakpoints, 253 with cdb, 240 command-line switch, 238 conditional compilation, 238 with dbx, 240 divide and conquer method, 237 interactive, 240 going through output, 239 save file, 232 with sdb, 240 decimal point, 57 decision statements, ii declarations, 42, 49 array, 7 data, 7 integer, 54 pointer, 184 structures, 7 variable, 52, 53 default statement, 118, 383 #define statement, 140-141 vs. const, 145 defining bit values, 163 dereference operator (x), 185 derived class, 356 diagnostic printf, 105 dimensions, array, 63 directories, 97 divide by 0 error, 254 divide operator (/), 51, 58 division, floating point, 268 do/while statement, 344 documents, government, 4 DOS Makefile, 316 double data type, 271, 272 double-linked list, 288, 290 double quotes, 60, 65 dynamic data structures, 279 E[ Top ] elements, 63, 173 else statement, 85, 147 Emacs editor, 43 #endif statement, 147 English language, 4 enum (enumerated) data types, 178 EOF (end of file) character, 210 escape character, 60 Evaluation order problems, 79 EVEN macro, 160 exclusive or (^), 158, 161 executable program, 11 executable statements, 51 extern, 306, 308 F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
E[ Top ] elements, 63, 173 else statement, 85, 147 Emacs editor, 43 #endif statement, 147 English language, 4 enum (enumerated) data types, 178 EOF (end of file) character, 210 escape character, 60 Evaluation order problems, 79 EVEN macro, 160 exclusive or (^), 158, 161 executable program, 11 executable statements, 51 extern, 306, 308 F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
F[ Top ] %f conversion, 77 factorial (program), 137 far pointers, 184 fclose, 210 fflush, 219, 255 fgetc, 210 fgets, 211 newline problem, 69 standard function, 67 Fibonacci (program), 87 fields, 173 bit, 179, 181 files, 209, 227 ASCII, 215, 216 binary, 215, 216, 338 closing, 210 FILE, 209 formats, 42, 224, 226 header, 308 naming, 209, 341 opening, 209 source, 8, 11 types, 342 variables, 209 float data type, 272 float.h include file, 272 floating point, 77, 265 accuracy, 269, 270 addition, 266 declaration, 58 division, 58, 268 floating point (continued) exception, 254 float.h, 272 guard digit, 266 multiplication, 267 numbers, 57, 60 overflow, 268 precision, 272 roundoff error, 269, 270 speed, 272 subtraction, 266 underflow, 268, 269 fopen, 209, 210 for statement, 115, 116 FORTRAN, 6, 116 fprintf, 212 fputc, 211 fputs, 211, 212 fread, 218 free, 282 fscanf, 213 FTP, obtaining exercises via, vii FTPMAIL, vii FTPMAIL, obtaining exercises via, vii functions, ii, 130 library, 51 standard, 8 fwrite, 218 G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
G[ Top ] -g (compiler option), 14 generic pointer, 281 global variables, 127 government documents, 4 graphics, bitmapped, 166 grind printer, 108 guard digit, floating point, 266 H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
H[ Top ] header files, 308 heading comments, 42, 50 hello (program), 39 helmet law, 4 help, 33 hexadecimal numbers, 78, 157 high-level languages, 6 histogram program, 316 I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
I[ Top ] if statement, 84 #ifdef statement, 147, 148 #ifndef statement, 147 include file, float.h, 272 include files, 148 #include statement, 148, 308 indentation, 45 indent program, 108 tools for, 107 indexes (and arrays), 64 infinite arrays, 305, 310, 313, 316 initializing multi-dimensional arrays, 74 strings, 74 structures, 175 variables, 73, 74 instructions, 8 integer declarations, 54 division, 58 long data type, 75 overflow, 61 types, 75, 77 unsigned, 75 very short (char), 76 interactive debugging, 240 isalpha, 296 K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
K[ Top ] Kernigham, Brian, 6 L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
L[ Top ] %L conversion, 77 labels, goto, 345 languages, 4-7 law, helmet, 4 learning C++, 9 left shift (<), 158,="" 162="">lex utility, 325 lexical analysis, 325 LF (line feed), 216 %lf conversion, 77 libraries, 8 library functions, 51 library, standard, 11 limit error, 61 line feed, 216 linear programs, 84 lines, in coding, 51 linked lists, 283, 310 add element, 284 locate element, 286 linker, 11 list command (dbx), 241 local header files, 308 include files, 149 variables, 127 long data type, 75, 76 long double integers, 77 portability and, 338 looping statements, 8, 84, 87 M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
M[ Top ] machine language, 5 macros definitions, 152 and parameters, 150 replacement, 142 magic numbers, 226 main, 50 maintaining code/programs, 38, 97 make, 101, 313 targets, 314 with multiple files, 313 Makefile, 101, 313 DOS, 316 malloc, 281 man pages (UNIX), 33 math operators, 51 mechanics of programming, ii memory, 7 memset, 260, 261, 317 min macro, 346 minimizing roundoff error, 270 mistakes, 10 mkdir command, 97 modifying code, 38 modularity, 337 modules, 304-305, 322, 324 MS-DOS, 216 _ _MSDOS_ _ (pre-defined symbol), 148 multi-dimensional arrays, 70, 74 multiple files, 304, 313 multiplication, floating point, 267 multiply and shifting, 162 multiply operator (x), 51 N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
N[ Top ] \n (newline character), 60 near pointers, 184 nested ifs, 47 include files, 149 new lines, 69 newline character (\n), 60 next command (dbx), 240 node, tree, 292 normal int and portability, 338 NUL character, 64 null pointers, 341 O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
O[ Top ] O_ flags, 221 object file, 11, 14 octal numbers, 78 ones complement (~), 161 open mode, 220, 221 operations, cost of, 262 operators, bitwise, 158 optimization, 256, 262 integer versus floating-point, 263 loop ordering, 257, 261 macros, 261 powers of 2, 258 reduction in strength, 262 register variables, 257 or opeator (|), 158, 160 ordered linked lists, 287 organization, program, 8 Oualline's law of documentation, 40 output redirection, 239 overflow, 61, 268 P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
P[ Top ] packed structures, 179, 181 pad characters, 340 parameterized macros, 150 parameters, passing, 188 parsing, 325 PASCAL, 6, 116 case statement, 119 passing parameters, 188 permanent variables, 127, 129 pixels, 166 pointers, ii alignment errors, 281 and arrays, 189, 191 const, 189 declaring, 184 far, 184 freeing, 283 generic, 281 near, 184 and structures, 200, 201, 279, 282 portability, 337 alignment restrictions, 339 byte order and, 338 word size and, 338 power series, 272 #pragma statement, 152 precision, floating point, 272 pre-defined symbols, 148 preliminary specification, 98 preprocessor, 140 abuse, 142 #define, 141 #else, 147 #endif, 147 hash mark and, 141 hidden errors, 143 #ifdef, 147 #ifndef, 147 #include, 148 running, 144 #undef, 147 print command (dbx), 240 print_file (program), 202 printers, pretty, 108 printf, 51, 56, 57, 212 floating points and, 61 string variables and, 66 printing a tree, 296 private modules, 305 programming mechanics of, ii styles of, ii, 136 programs, 8, 11 basic structure, 50, 51 life cycle of, 95 organization, 8 porting, 337 revising, 97 specification, 95, 98 testing, 358 pseudocode, 98 public modules, 305 pure virtual functions, 356 R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
R[ Top ] read function, 222 reading strings, 67 real division, 58 real numbers, 57 recursion, 136, 294 redirection, output, 239 references, 42 register variables, 257 relational operators, 85 requirements, 348 reserved words, 52 return code, main, 50 revisions, history, 42 revisions, program, 97, 107 right shift (>>), 158, 162 Ritchie, Dennis, 6 root, tree, 292 roundoff error, floating point, 269-270 run command (dbx), 240 runtime errors, 254 divide by 0 error, 254 floating-point exception, 254 Segmentation Violation, 254 stack overflow, 254 S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
S[ Top ] %s format (printf), 66 save files, 232 scanf, 71, 213 scope, variable, 127 sdb debugger, 240 search, tree, 293 Segmentation Violation, 254 setting bits, 163 shampoo, 4 shift left (<), 158,="" 162="">shift right (>>), 158, 162 shifting and multipling, 162 short data type, 76 portability and, 338 shorthand operators, 79 side effects, 79 sine, computing, 273 single quotes, 60 sizeof, 212 source code, 11 source file, 8, 11 special characters, 60 specification, 348 program, 95, 98 speed, floating point, 272 splitting a string, 197 spotting mistakes, 10 spreadsheets, 325 sprintf, 212 sscanf, 71, 213 stack overflow error, 129, 254 standard files, 210, 221 functions, 8 include files, 148 library, 11 statements assignment, 8 control, 8 decisions, ii for, 116 grouping, 85 looping, 8 while, 116 static modifier, 129, 306 status variable, 210 stderr, 210 stdin, 210 stdio.h, 148, 209 stdout, 210 step command (dbx), 240 stop command (dbx), 240 _ _STDC _ (pre-defined symbol), 148 strcat, 66 strcmp, 66, 86 strcpy, 65, 66 strings, 64 concatenating, 66 functions, 66 initializing, 74 newline problem, 69 reading, 67 splitting, 197 variable length, 65 strlen, 66, 68 Stroustrup, Bjarne, 7 struct, 173 structured programming, 135 structures, ii, 173, 181 declarations, 7 initializing, 175 initializing an array of, 181 packed, 179, 181 pointer operator (->), 287 and pointers, 200, 201 unpacked, 178 style, programming, ii subtraction operator (-), 51 subtraction, floating point, 266 sun, temperature, 274 Sun-3/50, 272 switch statement, 118, 124 symbol tables, 292 T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
T[ Top ] Teletype Model 33, 216 tempeture, sun, 274 temporary variables, 127, 129 testing bits, 163 programs, 97, 358 text editor, 11 tokens, 351 top-down programming, 136 translation, assembly language, 5 trees, 292 printing, 296 truncation, 58 _ _TURBOC _ (pre-defined symbol), 148 typedef statement, 177, 178 U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
U[ Top ] unbuffered I/O, 220 #undef statement, 147 underflow, floating point, 268 uninitialized variable, 55 unions, ii, 175 units, program, 44 unpacked structure, 178 unsigned numbers, 75, 76 upgrading, 38 V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
V[ Top ] variable-length strings, 65 variables, ii class, 127, 129 declarations, 7 declaring, 42, 44, 53 global, 127 initializing, 73, 74 local, 127 naming, 42, 44, 52, 383 permanent, 127, 129 scope, 127 temporary, 127, 129 type, 52 uninitialized, 55 version numbers, 226 very short int (char), 76 vi editor, 43 void x, 281 W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
W[ Top ] where command (dbx), 241 while statement, 87, 116 wildcard characters, 202 word size and portability, 338 write function, 222 Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
Y[ Top ] yacc utility, 325 Z[ Top ] zero-based counting, 116 END
Z[ Top ] zero-based counting, 116 END