C Programming
Course description
Overview: Students will learn the fundamentals of the C programming language.
Prerequisites: Background in a structured programming language, such as Pascal, is desirable, though not required.
Performance-based objectives
Lesson objectives help students become comfortable with the course, and also provide a means to evaluate learning. Upon successful completion of this course, students will be able to:
* Recognize the basic components and structure of a C program.
* Define variables by using the basic C data types; and use the fundamental C operators and operands in conjunction with variables to create C expressions and statements.
* Use the functions getchar(), putchar(), printf(), and scanf() to perform formatted input and output.
* Create control-flow statements with the C branching and looping constructs.
* Create modular programs by defining functions and by using the library functions and header files.
* Use arrays and pointers to store and manipulate data; and to use the gets(), puts(), strcmp(), and strcat() string functions to work with character strings.
* Define and use structures to work with groupings of related data; and use the malloc() and free() functions to allocate program memory.
* Use the #define and #include preprocessor directives to extend a C program; and use conditional compilation directives, global variables, and storage classes in working with multiple-file programs.
* Provide input and output (I/O) to a C program from the command-line or from a file with basic file I/O techniques.
Course content
Lesson 1: Introduction to C
The C Language and its Advantages
The Structure of a C Program
Writing C Programs
Building an Executable Version of a C Program
Debugging a C Program
Examining and Running a C Application Program
Lesson 2: Data Types and Variables
Data Types
Operands, Operators, and Arithmetic Expressions
Lesson 3: Input/Output Management
The Input/Output Concept
The getchar() and putchar() Functions and Single-character I/O
Formatted Input and the scanf() Function
Lesson 4: Control-Flow Statements
The Control-Flow Program Statements
Looping Statements
The Data-checking process
Lesson 5: Modular Programming with Functions
The C Function
Passing Data to Functions
Passing an Address to Modify a Value in Memory
Using Functions in the Checkbook Program
The C Standard Library Functions
Lesson 6: Arrays, Pointers, and Strings
Arrays
Pointers
Strings
Using Arrays, Strings, and Pointers in the Checkbook Program
Lesson 7: Structures and Dynamic Memory Allocation
Structures
Arrays of Structures
Passing Structures to Functions
Nesting Structures
Dynamic Memory Allocation
Lesson 8: The Preprocessor and Multiple-file Compilation
The C Preprocessor and the #include and #define directives
The Conditional Compilation Directives
Global Variables and Variable Storage Classes
Program Organization and Multi-file Compilation
Lesson 9: File Input/Output
Command-line Arguments
File Input and Output
Combining Command-line Arguments and File I/O
Appendices
The ASCII Table
The Bitwise Operators
A Comparison of the ANSI C and K&R Function Formats
Enumerated Data Types
Unions
Additional information: Although problem-solving skills are recognized as an integral component of computer programming, the primary focus of this course is to teach the specific components of the C language. Each lesson and activities focuses on this objective by having students examine and evaluate existing code, and modify or create new code that implements the components they have just learned about.