Class Resources


CS 102 Introduction to C Programming


Instructor: Danny Hardin
Office and Hours: Tech Hall N327 or N329 (Monday - Thursday 3:40 - 5:00 and by appointment.) or Canvas

Text: C How to Program Seventh Edition by Paul and Harvey Deitel
Software: Microsoft Visual Studio 2012 or 2013

Download Visual Studio 2012 Ultimate FREE
(Select the Download option and get the Visual Studio Ultimate 2013 90-day trial)

Get Visual Studio from UAH for FREE - Unlimited Use

Graduate Assistant: TBD
Office Hours:



Exams: 40% - Two major exams. (20% each)
Final: 20% - Final Exam (Thursday April 30, 3:00-5:30)
Homework & Programs: 30% - Assignments from textbook plus additional problems.
Class Attendance & In Class Exercises: 10%

Keep all your homework and programming assignments NEATLY ORGANIZED in a folder or soft cover binder. Always provide a paper copy of any programming assignments.


Course Objectives:

CS 102 - Introduction to C Programming

Hours:  Program design and implementation in the C programming language. Basic program structure, data types, control structures, and file organization. System libraries, input/output features. Cannot be counted toward a CS major. Prerequisite for CS 121

Program design and implementation in the C programming language. Basic program structure, data types, control structures, and file organization. System libraries, input/output features.

  • Introduce program design and implementation in the C programming language
  • Provide experience in these topics by means of structured lab exercises and programming assignments
  • Introduction to the MicroSoft Visual Studio C/C++ Programming Environment

Additional Class Materials:

Two Storage Devices (Memory Sticks or CD)
You should have at least two copies of all your files for this class. Always keep a backup for safety in case one of your devices fails, becomes lost, or you accidentally delete required files. You MAY be asked to turn in your flash drive containing C source code or Visual Studio project files. Typically homework will consist of a printout of your C source code along with screen captures showing the operation and output generated by the program. Click this link for an example.


Make sure that your name is on every item turned in.
Make copies of your files. It is also likely that you will accidentally delete files on occasion. KEEP A BACKUP!


UAH Course Policy

The following policies are adapted from the general policies of the Computer Science Department:

Attendance: Regular class attendance is required. You are responsible for all material covered in class, regardless of whether or not it is in the textbook, as well as for any announcements, assignments, or other class content. If you miss a class you are responsible for obtaining the missed assignments from a classmate.

Assignments: There will be numerous programming and written assignments. The assignments are crucial to your success in this course and you are expected to complete them all. Any assignment not turned in on time will receive a grade of zero. If you anticipate difficulty completing an assignment on time, make arrangements with the instructor before the assignment due date. Assignments are to be turned in at the BEGINNING of class on the date due. You will receive program and homework assignments well in advance of their due date.

Tests and Exams: Makeup exams will be given only if you have made prior arrangements with the instructor, and only if you have a valid reason for missing the test, such as illness, business trip or UAH athletic participation.

Incompletes: A grade of Incomplete is assigned by the instructor when a student, due to circumstances beyond his or her control, has not satisfied some requirement of the course. An example of a legitimate circumstance is an illness which prevents completion of a final program. If you have fallen behind in a class due to work, family obligations or other course work the appropriate solution is to withdraw from the course.

Withdrawals: The University policy for withdrawing from a class is as follows: through the eighth week of the Fall or Spring Semester a student may withdraw from any course. After the eighth week, a student may withdraw from a course only under extenuating circumstances and with the approval of the dean of the college in which the student is enrolled. Any student failing to follow the established procedure for withdrawal will continue to be enrolled in the class and may receive a failing grade in that course.

Software: You may develop your programming assignments on any computer, using any C compiler, but they must run under Microsoft Visual Studio 2012 in the classroom (N327) or lab (N329).




Class Topics and Homework Assignments

(Jan. 8)


Course Overview

Class Rules, Grading
Computer account application
Preview of coming attractions

How to use Visual Studio 2012 in this Course

Reading Assignment:
Read Chapter 1 Section 1.10 (pages 16-18)

1.10 Typical C Program Development Environment
Read Chapter 2 Sections 2.1 and 2.2 (pages 40-45)
2.1 Introduction
2.2 A Simple C Program: Printing a Line of Text

(Jan. 13)

Chapter 2
Sections 2.1-2.2

Introducing the MVS IDE; First C Program

The MicroSoft Visual Studio Integrated Development Environment
Creating and saving a project
My First C Program (Section 2.2)
Structure of a C Program

Template for C programs: C Program

Hello World: C Program
My information, shows some printf options: C Program

Printing special characters (C Program)
Making a Table with the tab (\t) (C Program)

Helllo World (Video)

(Jan. 15)

Chapter 2
Sections 2.1-2.2

Writing Information to the Console

Writing output to the console with printf
Escape sequences: \n, \t, \", \\
Line continuation with \ (backslash)
Find errors in a given program - correct and execute (Program File)

Formatting output with %d and %f
Input with scanf - Intro to variables

printf with integer constant numbers
printf with real constant numbers

input with scanf - intro to variables

Reading Assignment: Chapter 2
Read Sections 2.3 and 2.4 (pages 45-50)

2.3 Another Simple C Program: Adding Two Integers
2.4 Memory Concepts

(Jan. 20)

Chapter 2
Sections 2.3-2.4

Introduction to Variables; Read Data from Console, Add

Using variables, rules for variables
Reading keyboard input with scanf
Add two numbers
Writing results to the console with printf

In class example - simple calculations.

Integer arithmetic (C Program)
Real number arithmetic (C Program)
Operator Precedence (C Program)

Reading Assignment: Chapter 2
Read Section 2.5 (pages 50-54)
2.5 Arithmetic in C

Homework Assignment One: Due Jan. 22. (Click to download)
Sample Homework

(Jan. 22)

Chapter 2
Section 2.5

Arithmetic in C

Arithmetic operators +, -, *, /,and %
Precedence of arithmetic operators (Figure 2.10)
Integer and Real Variable types
Selected exercises from Chapter 2 (e.g. 2.16)
Assignment statements and simple computations


Reading Assignment: Chapter 2
Read Section 2.6 (pages 54-58)

2.6 Decision Making: Equality and Relational Operators

(Jan. 27)

Chapter 9
Sections 9.1, 9.2, 9.3, 9.4, 9.5, and 9.8
(Optional Reading)

Formated Printing of Integer and Real Values

The %d, %u, %f and %lf field specifiers


(Jan. 29)

Optional Material


Simple Programs, Writing Output to a File

Opening a file with fopen()
Writing to a file with fprintf()
Closing a file with fclose()
Viewing the output with MS Word
Viewing the output as a web page


Reading Assignment: Chapter Three
Read Sections 3.1 through 3.4 and 3.6 (pages 71-79)

3.1 Introduction
3.2 Algorithms
3.3 Pseudocode
3.5 The if Selection Statement
3.6 The if ... else Selection Statement

(Feb. 3)

Chapter 2
Sections 2.6

Decision Making - The Simple if Statement

Relational operators (Figure 2.12)
The simplest version of the "if" statement
Reading and comparing two numbers (Figure 2.13)
Selected exercises from Chapter 2 (e.g. 2.19, 2.24)


(Feb. 5)

Chapter 3
Sections 3.1 - 3.6

The if . . . else Statement

Syntax of the if ... else
The letter grade problem
Nested if ... else statements


(Feb. 10)

Chapter 3
Sections 3.7 - 3.8

Introduction to the While Loop

While loop syntax and programs
Counter controlled loop
Sentinel controlled loop


(Feb. 12)

Chapter 3
Sections 3.9 - 3.10

While Loop Examples

Additional while loop examples
Assignment operators - shorthand version
Increment and Decrement operators


(Feb. 17)

Chapter 3
Sections 3.11 - 3.12

Summations and Bounds Tests - While Loop


(Feb. 19)

Chapter 4
Sections 4.1-4.6

Introduction to the For Loop; Review for Exam I

For Loop Syntax
The Power of the For Loop


(Feb. 24)

Chapter 4
Sections 4.1-4.6

More of the For

Additional For Loop applications
Nested For Loops
Break and Continue


(Feb. 26)


Test on Chapters 2 and 3

(Mar. 3)

Chapter 4
Sections 4.8-4.9

The Do - While Loop & Loop Examples

Introduction to the Do - While Loop
Additional Loop applications


(March 5)

Chapter 5
Sections 5.1 - 5.5

Introduction to Functions

Math Library Functions
User defined functions - how to make your own
Function Prototype, Body and Call

Print Header(No arguments, return 0)
Print Header(With arguments - Problem and Page numbers, return 0)
Add Two Numbers(With two arguments - return sum)


(March 10)

Chapter 5
Sections 5.1 - 5.6

Basic Functions

Body Mass Index
Convert temperatures
Selected problems from previous homework assignments


(March 12)

Chapter 5
Section 5.10

Basic Functions - More Examples


(March 17)

Chapter 5
Sections 5.6, 5.8, 5.13 & 5.14

Random Numbers

Introduction to the rand and srand functions
Introduction to the switch statement
Simulating dice rolls - Figures 5.11, 5.12 and 5.13

(March 19)

Chapter 5
Sections 5.6, 5.8, 5.13 & 5.14

Advanced Topics of Functions

Scope Rules


(March 31)

Chapter 5
Sections 5.6, 5.8, 5.13 & 5.14

Functions & the Switch Statement

(April 2)

Chapter 6
Section 6.1 - 6.4

Arrays Part I: One Dimensional Arrays

Introduction to One Dimensional Arrays
Defining an array
Initializing an array with values
Printing an array


(April 9)

Chapters 4 & 5


(April 14)

Chapter 6
Section 6.1 - 6.4

Characters and Strings

Introduction to character and string arrays
Using %c for character input
Using %s for string input and output
Getchar and Putchar Examples
Reading input from a file


(April 16)

Chapter 6
Section 6.5

Arrays Part II: Operations on One Dimensional Arrays

Sum the elements of an array
Copy an array
Locate a specific value in an array
Put a value in a specific array location


(April 21)

Chapter 6
Section 6.9

Arrays Part III - Passing Arrays to Functions

Mechanics of passing an Array to a Function
Performing simple array operations with functions
Static Arrays


(April 23)

Chapter 6

Multidimensional Arrays, Review for Final

Introduction to Multi Dimensional Arrays
Initializing an array with values
Printing a two dimensionsal array
The Airline Reservation problem - (Find and reserve a seat)




(April 30)


FINAL EXAM (April 30, 3:00 - 5:30)