Intermediate C Programming
Revision: TE2103_20120930
(10.46 KB) View, Download, or Print Course as a PDF.

- Course Length:
- 5 Days
- Course Description:
- This course broadens the skills of a C Language Programmer by introducing sophisticated problem solving techniques including the advanced use of pointers, abstract data types, data structures, portability, and optimization techniques. Skills are reinforced by hands-on laboratory exercises.
- Who Should Attend:
- This course is for anybody who has been programming in C for at least six months or who is a skilled programmer and has taken a C introductory course.
- Benefits of Attendance:
-
Upon completion of this course, students will be able to:
- Master the use of pointers in a wide variety of problems.
- Use sophisticated pointer techniques to solve problems involving advanced data structures such as lists, stacks, queues and trees.
- Choose from a wide variety of data structures to implement the most efficient solution to a problem.
- Apply the proper optimization technique to C code.
- Apply many portability techniques to C code.
- Use bit manipulation techniques for efficient solutions to problems.
- Write programs that emphasize modern program design techniques which emphasize code reuse.
- Write powerful C programs that make "calls" directly into the UNIX operating system through the use of system calls.
- Decrease development time in writing applications through a more thorough understanding of sophisticated concepts in C.
- Prerequisites:
- Students should have at least six months of C programming experience.
- Course Outline:
-
- Chapter 1: A Review of C
- Data Types
- Operators
- Control Flow Constructs - if
- Loops
- switch
- Derived Data Types
- Arrays
- Array vs. Pointer
- Arrays and Pointers
- Structures
- Header File for a Structure
- Use of Structures
- Structure References
- Structure Assignments
- Unions
- Bitfields
- Enumerations
- Chapter 2: Functions
- Function Fundamentals
- Function Prototypes
- Function Invocation and Definition
- Subprogram Examples
- Functions Returning a Value
- Return Value Considerations
- Recursive Functions
- Evaluation of Function Arguments
- Variable Number of Arguments
- Scope of Variables
- Storage Class Attributes
- Initialization
- Chapter 3: Bit Manipulation
- Characteristics of Bitwise Problems
- Defining the Problem Space
- Bitwise Operators
- Readability Aids
- Assigning Bit Values
- Writing Bitwise Functions
- Circular Shifts
- Character Information Array
- Direct Lookup
- Mapping With Bits
- Radix Sort
- Chapter 4: Pointers
- Common Pointer Constructions
- Pointer Arithmetic
- Binary Search
- Command Line Arguments
- The Environment Pointer
- Changing a Pointer through a Function Call
- Processing Arrays With Pointers
- Simulation Example
- Simulating Higher Dimensional Arrays
- Two Dimensional Arrays
- Complex Declarations
- Pointers to Functions
- Surrogate Sorting: A Pointer Application
- Sorting with Large Records
- Chapter 5: Designing Data Types: Structures
- Steps in Creating Data Types
- Rationale For a New Data Type
- The File fraction.h
- Operations on the Fraction Data Types
- Implementation of the Functions
- Example Program Using Fractions
- Applications with Fractions
- Set Notation Examples
- Creating the Set Type
- Set Representation Example
- Set Representation
- Set Function Implementations
- A Program Which Uses The Set Data Type
- Chapter 6: Data Structures
- Potential List Elements
- Lists - What Are They?
- Problems With a List as an Array
- Lists as Arrays
- Benefits of Linking Elements
- A List of Linked Elements
- Defining the List Data Type
- The List Data Type
- Implementations of List Functions
- A Simple Program With a List
- Other Types of Lists
- The Need for Other Kinds of Lists
- Ordered Lists
- The rand Function
- Circular Lists
- Circular List Code
- Circular Lists Principles
- Two Way Lists - Example
- Two Way Lists
- Two Way List - print, order
- Two Way List - main
- Structures for Networks
- Networks
- Hashing is Close to Direct Lookup
- Hashing / Searching
- The Hashing Algorithm
- Hashing main Program
- Example Code For Linear Collision
- Linear Collision Handling
- The chain.h File
- Chaining Collision Handling
- Chaining - lookup Function
- Chaining Code - main
- Stacks
- Stack Representation
- Solving Problems With Stacks
- Picture of the Stack
- Push and Pop Functions
- The Calculator Driver Program
- Queues
- Queue Driver Program
- Binary Trees
- Traversing Trees
- tree.h
- Left-Root-Right Traversal
- Tree Algorithms
- Chapter 7: Optimization Techniques
- Knowing When to Optimize
- Where to Optimize
- Examples of Macros
- Macros
- Knowing When to Initialize
- Initialization
- Modifying the Data Structure - Example
- Caching - Ready Access
- Invariant Expressions
- Logical Inefficiencies
- Odds and Ends Examples
- Odds and Ends
- Chapter 8: Portability
- Different Kinds of Portability
- Source Code Portability
- Prototype Problems
- Portability with Functions
- Problems with ints
- Arithmetic Data Types
- Problems with Bits
- Bit Manipulation
- Portable Masks
- Pointer Problems
- ANSI vs. Non-ANSI Examples
- ANSI vs Non-ANSI
- Odds and Ends Examples
- Odds and Ends
- Appendix A: Software Tools
- The cc Command
- Different C Compilers
- Options - Examples
- Compiler Options
- Conditional Compile Examples
- Conditional Compilation
- Positing Assertions
- The assert Macro
- Libraries
- Header File Support
- Libraries
- Graphics Coordinates
- A Graphics Example
- Examples of the Need for make
- The make Command
- An Example Makefile
- The make Dependency Tree
- SCCS Example
- Source Code Control System
- After a Revision Cycle
- Source Code Control System
- Appendix B: Library Functions
- Building Command Strings
- system
- exit and atexit Examples
- exit and atexit
- signal
- Using strtok
- strtok
- memcpy and memset
- memcpy - memset
- Using qsort
- quicksort
- Binary Search Example
- bsearch
- strstr Example
- strstr
- strchr Example
- strchr, strrchr
- Data Validation Example
- strspn, strcspn
- Appendix C: File Access
- I/O From Applications Programs
- System Calls vs. Library Calls
- The fopen Function
- Opening Disk Files
- Table of Access Modes
- Access Modes
- Reasons for an fopen Failure
- Errors In Opening Files
- Example: Copying a File
- I/O Library Calls
- Character vs Line Examples
- Character Input vs Line Input
- Interpreting Input
- Motivation for the scanf Function
- scanf Examples
- scanf
- sscanf Example
- scanf Variants
- fscanf and scanf Example
- scanf Variants
- sprintf and fprintf Examples
- printf Variants
- An fclose Example
- Closing Files - fclose
- Error Examples
- Servicing Errors - errno
- Servicing Errors - Example
- Servicing Errors - errno.h
- Application for Binary I/O
- Binary I/O
- The main Function - Code
- The main Function
- create_db Function - fwrite
- fwrite
- print_db Function - fread
- fread
- retrieve_db Function
- fseek
- fflush and ftell Example
- fflush and ftell
- Exercises
- Chapter 1: A Review of C

















