Programming with C/C++

12/8/98


Click here to start


Table of Contents

Programming with C/C++

Course Division

Programming with C Recommended Texts

Part 1 Structure

How C Differs from Java?

Block Diagram of a Simple Java Program

Block Diagram of a Simple C Program

Structure of a C Program

File Extensions for C

Compilation

Functions (An Introduction)

A Simple C Function

C Types

Pointers (1)

Pointers (2)

Pointers (3)

The Address-of Operator and Pointer Dereferencing

Arrays

Strings

Simple I/O - Output (1)

Simple I/O - Output (2)

Simple I/O - Input (1)

Simple I/O - Input (2)

Simple I/O - Format Specifiers

Complex Types - Structures

Defining New Types

Accessing Members of a Structure

Complex Types - Enumerated Types

Complex Types - Unions

Type Casting

Operators - Unary and Assignment

Operators - Arithmetic

Operators - Arithmetic (Shortcuts)

Operators - Logical

Operators - Bitwise

Operators - Bitwise (Shortcuts)

Flow Control (Conditionals) - If Else

Flow Control (Conditionals) - Switch

Flow Control (Conditionals) - Switch (Examples)

Flow Control (Looping) - While and Do While

Flow Control (Looping) - While and Do While (Examples)

Flow Control (Looping) - For

Flow Control - Break and Continue

Functions (Revisited)

Commonly Used Library Functions

Command Line Arguments

Dynamic Memory Allocation

Part 2

Programming with C++ Recommended Texts

The Language C++

C++: In Comparison with C

C++: In Comparison with Java

Part 2 - Structure

Dynamic Memory Allocation

Using new and delete

Class Structure

Scope Resolution

Static Members

Access Control

Friends

Friends (continued)

Using References

Accessing Class Members

Shallow and Deep Equality

The Copy Constructor

The Assignment Operator

The Rule of THREE

Simple I/O

Compiling the Programs

.h: Once Only Idiom

Operator Overloading (1)

Operator Overloading (2)

Operator Overloading (3)

Operator Overloading (4)

Operator Overloading (5)

Operator Overloading (6)

Operator Overloading (7)

Operator Overloading (8)

Operator Overloading (9)

Single Inheritance

Calling Super-class Constructor

The Rule of Substitutability

Virtual Functions

Virtual Functions (contd.)

Virtual Functions (contd.)

Abstract Classes

Multiple Inheritance

Problem with Multiple Inheritance

Problem with Multiple Inheritance: The Solution

What are Generic Classes

Why Special Treatment for Generic Classes?

Using void*

Using Templates (1)

Using Templates (2)

Exception Handling

Author: M. A. Rashid

Email: marash@comp.lancs.ac.uk

Home Page: http://www.comp.lancs.ac.uk/computing/users/marash/