| WA1077 C Programming Course Outline |
|
| 1. Introduction |
|
- Welcome to C
- Course Objectives
- Practical Exercises
- Features of C
- The History of C
- Standard C vs. K&R C
- A C Program
- The Format of C
- Another Example
- Variables
- printf and scanf
- Integer Types in C
- Integer Example
- Character Example
- Integers with different bases
- Real types in C
- Real Example
- Constants
- Warning!
- Named Constants
- Preprocessor Constants
- Take Care With printf and scanf!
|
|
| 2. Operators in C |
|
- Operators in C
- Arithmetic Operators
- Using Arithmetic Operators
- The Cast Operator
- Increment and Decrement
- Prefix and Postfix
- Truth in C
- Comparison Operators
- Logical Operators
- Logical Operators
- Bitwise Operators
- Bitwise Example
- Assignment
- Other Assignment Operators
- sizeof Operator
- Conditional Expression Operator
- Precedence of Operators
- Associativity
- Precedence/Associativity Table
|
|
| 3. Control Flow |
|
- Control Flow
- Decisions if then
- if then else
- Nesting ifs
- switch
- More about switch
- while loop
- Semicolon Warning!
- while, not until!
- do while
- for loop
- for is not until either!
- Stepping with for
- Extending the for loop
- break
- continue
|
|
| 4. Functions |
|
- The RulesWriting a Function
- Calling a Function
- Prototypes
- Prototyping is Not Really Optional
- Writing Prototypes
- Take Care With Semicolons
- Example Prototypes
- Example Calls
- Rules of Visibility
- Call by Value
- Call by Value
- C and the Stack
- Stack Example
- Storage
- auto
- static
- register
- Global Variables
|
|
| 5. Pointers |
|
- Pointers
- Declaring Pointers
- Example Pointer Declarations
- The "&" Operator
- Rules
- The "*" Operator
- Writing Down Pointers
- Initialisation Warning!
- Initialise Pointers!
- NULL
- Fill in the Gaps
- Type Mismatch
- Call by Value
- Reminder
- Call by Reference
- Pointers to Pointers
|
|
| 6. Arrays in C |
|
- Declaring Arrays
- Accessing Elements
- Array Names
- Passing Arrays to Functions
- Using Pointers
- Pointers Go Backwards Too
- Pointers May be Subtracted
- Using Pointers
- * and ++
- Which Notation?
- Strings
- Printing Strings
- Null Really Does Mark the End!
- Assigning to Strings
- Pointing to Strings
- Multidimensional Arrays
|
|
| 7. Structures in C |
|
- Concepts
- Setting up the Template
- Creating Instances
- Initialising Instances
- Structures Within Structures
- Accessing Members
- Unusual Properties
- Instances May Be Assigned
- Passing Instances to Functions
- Pointers to Structures
- Why (*p).name?
- Using p->name
- Pass by Reference
- Returning Structure Instances
- Linked Lists
- Example
- Printing the List
|
|
| 8. Reading C Declarations |
|
- Introduction
- SOAC
- typedef
|
|
| 9. Handling Files in C |
|
- Introduction
- Streams
- What is a Stream?
- Why stdout and stderr?
- stdin is Line Buffered
- Opening Files
- Dealing with Errors
- File Access Problem
- Copying Files
- Convenience Problem
- Accessing the Command Line
- Useful Routines
- Binary Files
|
|
| 10. Miscellaneous Things |
|
- Unions
- Remembering
- Enumerated Types
- Using Different Constants
- The Preprocessor
- Including Files
- Pathnames
- Preprocessor Constants
- Avoid Temptation!
- Preprocessor Macros
- A Debugging Aid
- Working With Large Projects
- Data Sharing Example
- Data Hiding Example
- Use Header Files
- Getting it Right
|
|
| 10. C and the Heap |
|
- What is the Heap?
- How Much Memory?
- Dynamic Arrays
- Using Dynamic Arrays
- calloc/malloc Example
- realloc Example
- realloc can do it all
- Allocating Arrays of Arrays
- Dynamic Data Structures
- Linking the List
|
|