Table of contents
Preface (19)
About the author (21)
Chapter 1: We begin (23)
- Where's C? (23)
- Why C? (24)
- Performance characteristics (25)
- Effectiveness (25)
- Portability (25)
- Power and flexibility (25)
- Focus on the programmer (26)
- Weaknesses (26)
- Where's C going? (26)
- What do computers do? (28)
- High level languages and compilers (29)
- Using C: seven steps (29)
- Step 1: definition of programme objectives (30)
- Step 2: designing the programme (30)
- Step 3: code writing (31)
- Step 4: Compilation (31)
- Step 5: Launch the programme (32)
- Step 6: Testing and debugging (32)
- Step 7: 'Nursing' and programme modification (33)
- Comment (33)
- Programming mechanics (33)
- Object code files, executable files and libraries (34)
- UNIX (36)
- Linux (38)
- Integrated development environments (Windows) (38)
- DOS Compilers for IBM PCs (40)
- C a Macintosh (40)
- Language standards (40)
- ANSI/ISO C standard (41)
- Standard C99 (42)
- How this book was organized (43)
- Recording methods (43)
- Font (43)
- Screen text (43)
- Chapter Summary (45)
- Checking questions (45)
- Exercise (45)
Chapter 2 Introduction to C (47)
- Simple example of C language (47)
- Explanation (48)
- Approach 1: Quick summary (48)
- Approach 2: details (50)
- Building a simple programme (59)
- How to make your program readable? (60)
- Next step (60)
- Documentation (61)
- Multiple declarations (61)
- Multiplying (61)
- Multi-value display (62)
- Many functions (62)
- Fault elimination (64)
- Syntactic errors (64)
- Semantic errors (65)
- Status of the programme (67)
- Key words (67)
- Key issues (68)
- Summary of Chapter (69)
- Checking questions (69)
- Exercises (70)
Chapter 3 Data in C (73)
- Sample programme (74)
- Variables and constants (76)
- Key words of data types (76)
- Total and floating point types (77)
- Total number (78)
- Variable point number (79)
- Data types in C (80)
- Type int (80)
- Other total types (84)
- Use of characters: type char (89)
- Type _Bool (95)
- Transferable types: inttypes.h (96)
- Float, double and long double types (98)
- Composite and imaginary types (103)
- Other types (103)
- Type sizes (105)
- Use of data types (107)
- Attention to arguments (107)
- One more example (109)
- What's going on? (110)
- Potential problem (111)
- Key issues (111)
- Chapter Summary (112)
- Checking questions (113)
- Exercises (115)
Chapter 4 Character chains and formatted input/output (117)
- For starters... the program (118)
- Character chains: introduction (119)
- Char and zero sign tables (119)
- Use of chains (120)
- Function strlen() (121)
- Fixed and preprocessor C (123)
- Const modifier (127)
- Standard constants (127)
- Know and use printf() and scanf() (129)
- Function printf() (130)
- Use of printf() (130)
- Conversion-specific modifiers for printf() (132)
- Importance of conversion (138)
- Using the scanf() function (144)
- Modifier * in the functions printf() and scanf() (150)
- Practical tips (151)
- Key issues (152)
- Chapter summary (153)
- Checking questions (154)
- Exercises (156)
Chapter 5 Operators, expressions and instructions (159)
- Access to the loop (160)
- Basic operators (162)
- Assignment operator: = (162)
- Adding operator: + (164)
- Subtraction operator: - (165)
- Mark operators: - i + (165)
- Multiplication operator: * (166)
- The sharing operator: / (168)
- Priority of operators (169)
- Priority and order of calculation (171)
- Some other operators (172)
- Operator sizeof and type size_t (172)
- Operator modulo: % (173)
- Incrementation and decoration operators: ++ i -- (175)
- Decoration -- (179)
- Priority (180)
- Don't try to be too clever (181)
- Expressions and instructions (182)
- Expressions (182)
- Instructions (183)
- Complex instructions (blocks) (186)
- Type conversions (188)
- Projection operator (190)
- Functions with arguments (192)
- Example programme (194)
- Key issues (195)
- Chapter Summary (196)
- Checking questions (197)
- Exercises (200)
Chapter 6 Control instructions C: Loops (203)
- Example (204)
- Comment (205)
- Reading loop in style C (207)
- Instruction while (207)
- End of loop while (208)
- When does the loop end? (208)
- while as a loop with entry condition (209)
- Guidance on syntax (210)
- What is more: the use of operators and relational expressions (211)
- What is the truth? (213)
- What else is true? (214)
- Problems with the truth (215)
- New type _Bool (218)
- Priority of the Relational Operators (219)
- Loops not specified and counting loops (221)
- Loop for (222)
- Flexibility of the loop for (224)
- Other imputation operators: +=, -=, *=, /=, %= (228)
- Comma operator: , (229)
- Zenon of Elea versus loop for (231)
- Loop with exit condition: do while (233)
- Which loop to use? (236)
- Nested loops (237)
- Discussion (238)
- Another option (238)
- Tables (239)
- Collaboration of the board and loop for (240)
- Example using loop and value returned by function (242)
- Discussion of the programme (245)
- Use of value-return functions (246)
- Key issues (246)
- Chapter summary (247)
- Checking questions (248)
- Exercises (252)
Chapter 7 Control instructions C: Branches and jumps (257)
- If instruction (258)
- Add another (260)
- Another example: getchar() and putchar() functions (262)
- Character function family ctype.h (264)
- A choice from many possibilities: else if (266)
- Combining else with if (269)
- More about nested instructions if (271)
- Let's be logical (275)
- Alternative recording: iso646.h header file (277)
- Priority (277)
- Order of calculation (278)
- Ranges (279)
- Word programme (280)
- Conditional operator: ?: (284)
- Loop additions: continue and break (286)
- Continue instruction (286)
- Break instruction (289)
- Choice from many possibilities: switch and break (291)
- Using switch instructions (293)
- Downloading only the first character in the line (294)
- Multiple labels (295)
- Switch a if else (298)
- Go-to instructions (298)
- Key issues (301)
- Chapter summary (302)
- Checking questions (303)
- Exercises (306)
Chapter 8 Input/output and diversion marks (309)
- One-character I/O: getchar() and putchar() (310)
- Buffers (311)
- Terminating keyboard input (313)
- Files, streams and keyboard input (313)
- End of file (314)
- Redirecting a file (317)
- Redirectioning in UNIX, Linux and DOS (318)
- Creating a more user-friendly interface (322)
- Cooperation with buffered entrance (322)
- Combining numerical and character input (325)
- Input validation (328)
- Programme analysis (332)
- Input streams and numbers (333)
- Menu (334)
- Tasks (334)
- Towards a smooth operation (335)
- Combining sign and number data (337)
- Key issues (340)
- Chapter Summary (340)
- Checking questions (341)
- Exercises (342)
Chapter 9 Functions (345)
- Reminder (345)
- Creating and using a simple function (347)
- Programme analysis (347)
- Functional arguments (350)
- Defining an argument extraction function: formal arguments (351)
- Prototype of an argument retrieving function (352)
- Calling an argument retrieval function: factual arguments (353)
- Black box point of view (354)
- Returning values with return instructions (354)
- Types of functions (357)
- ANSI C Prototypes (358)
- Problem (359)
- ANSI to the rescue! (360)
- No arguments and unspecified arguments (361)
- The power of prototypes (362)
- Competition (362)
- Unclassified competition (363)
- Basis for recurrence (364)
- Final competition (365)
- Re-competition and reversal (367)
- Pros and cons of competition (369)
- Compilation of programs containing more than one function (371)
- UNIX (371)
- Linux (371)
- DOS (Command line compilers) (372)
- Windows and Macintosh Computers (372)
- Using header files (372)
- Obtaining addresses: operator & (376)
- Modification of variables in the call function (377)
- Indicators: first glance (379)
- The operator of the dereference: * (380)
- Declaration of indicators (381)
- Use of indicators for communication between functions (382)
- Key issues (386)
- Chapter summary (387)
- Checking questions (387)
- Exercises (388)
Chapter 10 Tables and indicators (391)
- Tables (391)
- Initialisation (392)
- Use of const with tables (393)
- Note on variable classes (394)
- Designated initialisation (C99) (397)
- Assigning values to tables (398)
- Range of tables (398)
- Determining the table size (400)
- Multidimensional tables (401)
- Two-dimensional table initialization (404)
- Indicators for tables (405)
- Functions, tables and indicators (408)
- Use of indicator arguments (411)
- Comments: indicators and tables (414)
- Action on indicators (414)
- Protection of the table contents (419)
- Use of const keyword in formal parameters (420)
- More about const (421)
- Indicators and multidimensional tables (423)
- Indicators for multidimensional tables (426)
- Compliance of indicators (428)
- Functions and multidimensional tables (429)
- Variable - length array (VLA) tables (433)
- Complex letters (437)
- Key issues (439)
- Chapter summary (440)
- Checking questions (441)
- Exercises (443)
Chapter 11 Character chains and chain functions (447)
- Chain representation and chain input/output (447)
- Defining chains (449)
- Chain fixed (449)
- Chain tables and initialization (450)
- Table a indicator (452)
- Character chain tables (455)
- Indicators and chains (456)
- Loading chains (458)
- Creating a place (458)
- Function gets() (459)
- Function fgets() (461)
- Function scanf() (462)
- Chain display (464)
- Function puts() (464)
- Function fputs() (465)
- Printf() function (466)
- Do it yourself. (466)
- Chain functions (469)
- Strlen() function (469)
- Strcat() function (471)
- Strncat() function (472)
- Function strcmp() (473)
- Functions strcpy() and strncpy() (478)
- Sprintf() function (483)
- Other chain functions (484)
- Example of use: sorting of chains (486)
- Sorting indicators instead of chains (487)
- Sorting algorithm by selection (488)
- Chains and character functions of the ctype.h family (489)
- Command line arguments (491)
- Command line arguments in integrated environments (493)
- Macintosh command line arguments (493)
- Conversion of chains to numbers (494)
- Key issues (497)
- Chapter Summary (497)
- Checking questions (498)
- Exercises (501)
Chapter 12 Variable classes, connectivity and memory management (503)
- Classes of variables (503)
- Range of variable (504)
- Variable communication (506)
- Variable duration (507)
- Automatic variables (507)
- Register variables (512)
- Block range static variables (513)
- External communication static variables (514)
- Internal communication static variables (519)
- Multi-file programmes (520)
- Variable Class Specificators (521)
- Variable classes and functions (524)
- Which class to choose? (524)
- Pseudo-random functions and static variables (525)
- Dice throw (528)
- Memory allocation: malloc() and free() functions (532)
- Meaning of free() function (536)
- Calloc() function (537)
- Dynamic memory allocation and variable-size arrays (538)
- Variable classes and dynamic memory allocation (539)
- ANSI C type qualifier (540)
- Const type qualifier (540)
- Volatile type qualifier (543)
- Restriction type qualifier (544)
- Old keywords in new places (545)
- Key issues (546)
- Chapter summary (547)
- Checking questions (548)
- Exercises (550)
Chapter 13 Files handling (553)
- Information exchange with files (553)
- What is a file? (554)
- Input/output levels (555)
- Standard files (556)
- Standard input/output (556)
- Checking command line arguments (557)
- Function fopen() (558)
- Functions getc() and putc() (559)
- EOF end of file sign (560)
- Function fclose() (561)
- Indicators for standard files (562)
- Unsophisticated file compression program (562)
- File input/output: fprintf(), fscanf(), fgets() and fputs() (564)
- Functions fprintf() and fscanf() (564)
- Functions fgets()and fputs() (565)
- Free access adventures: fseek() and ftell() (568)
- How do fseek() and ftell() function? (569)
- Binary mode and text mode (571)
- Portability (571)
- Functions fgetpos() and fsetpos() (572)
- Behind the scenes of standard input/output (573)
- Other standard input/output functions (574)
- Int ungetc(int c, FILE *fp) (574)
- Int fflush() function (574)
- Function int setvbuf() (575)
- Binary input/output: fread() and fwrite() (575)
- Function size_t fwrite (577)
- Function size_t fread(void *ptr, size_t size, size_t nmemb, FILE *fp) (578)
- Functions int feof(FILE *fp) and int ferror(FILE *fp) (578)
- Example (578)
- Free in binary input/output (581)
- Key issues (583)
- Chapter summary (583)
- Checking questions (584)
- Exercises (586)
Chapter 14 Structures and other data forms (589)
- Example of problem: creating a book inventory (590)
- Declaration of structure (591)
- Definition of a structural variable (592)
- Structure initialisation (593)
- Accessing structure components (594)
- Structure-bearing initiators (595)
- Tables of structures (596)
- Structure table declaration (598)
- Indication of components of the structure table (599)
- Programme details (599)
- Nested structures (600)
- Indicators to structures (602)
- Declaration and initialisation of the indicator to structure (603)
- Access to ingredients with the indicator (604)
- Structures and functions (604)
- Transfer of structure components (605)
- Use of the structure address (606)
- Providing the structure as an argument (607)
- More about the new, improved status of the structure (607)
- Structures or indicators to structures? (611)
- Character tables or character indicators in structure (612)
- Structures, indicators and malloc() function (613)
- Complex letters and structures (C99) (615)
- Flexible Table Components (C99) (617)
- Functions using structure tables (619)
- Saving structure content to file (620)
- Structures: what next? (625)
- Unie: a quick look (625)
- Calculation types (628)
- Solid enum (629)
- Default values (630)
- Assigned values (630)
- Use of enum (630)
- Shared namespace (632)
- typedef: a quick look (632)
- Strange declarations (635)
- Functions and indicators (637)
- Key issues (644)
- Chapter summary (644)
- Checking questions (645)
- Exercises (648)
Chapter 15 Bit manipulation (653)
- Binary numbers, bits and bytes (654)
- Binary integers (654)
- Total numbers with the mark (655)
- Binary floating point numbers (656)
- Other numerical systems (657)
- Eight-way system (657)
- Hexadecimal system (657)
- Bit operators (659)
- Bit Logic Operators (659)
- Application: masks (660)
- Application: switching of bits (661)
- Application: bit switching off (662)
- Application: bit inversion (662)
- Application: checking the bit value (663)
- Bit shift operators (663)
- Example (665)
- Another example (666)
- Bit fields (668)
- Example (670)
- Bit fields and bit operators (673)
- Key issues (680)
- Summary of Chapter (680)
- Checking questions (681)
- Exercises (683)
Chapter 16 Preprocessor and library C (685)
- First steps in programme translation (686)
- Symbolic constants: #define (687)
- Tokens (691)
- Redefinition of fixed (691)
- #define and arguments (692)
- Arguments of macros in chains (695)
- Preprocessor switch: operator ## (696)
- Macros with variable number of arguments: ... and __VA_ARGS__ (697)
- Macro or function? (698)
- Attaching files: #include (699)
- Header files: example (700)
- Header file applications (702)
- Other directives (704)
- Directive #undef (704)
- Defined: from the perspective of the C preprocessor (705)
- Conditional compilation (705)
- Pre-defined macros (710)
- #line and #error (711)
- #pragma (712)
- Woven-in functions (inline) (713)
- Language library C (715)
- Accessing library C (716)
- Use of function descriptions (716)
- Library of mathematical functions (718)
- Library of general purpose tools (720)
- Functions exit() and atexit() (721)
- Function qsort() (723)
- Using the qsort() function (725)
- Definition of the porovnaj() function (726)
- Assert.h library (728)
- Functions memcpy() and memmove() from string.h library (729)
- Variable number of arguments: stdarg.h (731)
- Chapter Summary (734)
- Checking questions (735)
- Exercises (736)
Chapter 17 Advanced data representation (739)
- We get to know the data representation (740)
- Combined letters (743)
- Abstract data types (ATD) (751)
- Queues (767)
- Definition of a queue as an abstract data type (767)
- Queue simulation (778)
- Combination list or array? (784)
- Binary trees (788)
- What's next? (812)
- Key issues (813)
- Chapter Summary (813)
- Checking questions (814)
Appendix A Answers to verification questions (817)
Appendix B Summary (855)
- I. Supplementary reading (855)
- II. C-language operators (859)
- III. Basic variable types and classes (865)
- IV. Expressions, instructions and program control flow (870)
- V. ANSI C standard library and C99 extensions (876)
- VI. Extended total types (922)
- VII. Support for extended character sets (926)
- VIII. More efficient numerical calculations in standard C99 (932)
- IX. Differences between C and C++ (936)
Scorch (943) |