Table of Contents 1. Introduction to SCI Programming 1 2. SCI Statement Structure 2 3. SCI Program Structure 3 4. Functions 6 4.1. Library Functions 6 4.1.1. putd() 7 4.1.2. getchar() 7 4.1.3. puts() 7 5. Your First Programs 9 5.1. Hello again, world! 9 5.2. Fahrenheit to Celsius 10 6. Statements: Simple and Compound 11 6.1. Comment Statements 12 7. Expressions 14 7.1. Operators 14 7.1.1. Binary Operators 14 7.1.2. Unary Operators 14 7.2. Precedence 15 7.3. Associativity 15 7.4. Arithmetic operators 16 7.5. Bitwise Operators 16 8. Variables 17 8.1. Naming Conventions 17 8.2. Data Types 18 8.2.1. Char 18 8.2.2. Int 18 8.3. Scope 19 8.3.1. Global Variables 19 8.3.2. Local Variables 20 8.3.3. Function Arguments 21 8.3.4. System Globals 22 8.4. Location of Variables 22 8.4.1. The Stack 22 8.4.2. Program and Data Segments 23 9. Constants 24 9.1. Hexadecimal Constants 24 9.2. Octal Constants 24 9.3. ASCII Character Constants 24 9.4. String Constants 25 10. Assignment Operator 27 10.1. Lvalues and Rvalues 27 11. Comma Operator 29 12. Flow Control 30 12.1. if and if-else 30 12.1.1. More About Statements 32 12.1.2. Relational Operators 35 12.1.3. Logical Operators 36 12.1.4. Precedence and Associativity 37 12.1.5. Examples 39 12.2. while 40 - i - Table of Contents 12.3. for 41 12.4. switch 43 13. Arrays 47 14. Pointers 49 14.1. Lvalues and Rvalues Revisited 50 14.2. Pointer Operator 50 14.2.1. Pointer Expressions 53 14.2.2. printf() 54 14.3. Address Operator 55 14.3.1. scanf() 57 15. Increment and Decrement Operators 59 16. A Tour Through the File I/O Functions 62 16.1. fopen() 62 16.2. fclose() 63 16.3. fgetc() and fputc() 64 16.4. fgets() and fputs() 64 16.5. fread() and fwrite() 65 16.6. fseek() and ftell() 66 17. The Debuger 68 17.1. Introduction 68 17.2. Enabling the Debuger 69 17.3. Sample Debug Session 71 17.3.1. Exiting the Debuger 72 17.3.2. Single Stepping 73 17.3.3. Displaying Global Variables 74 17.3.4. Breakpoints 75 17.3.5. Function Call Trace Back 76 17.3.6. Examine a Program 77 18. The Shell 79 18.1. Customizing the Shell 81 18.2. DOS Command Line Arguments to the Shell 84 - ii -