Some Miscellaneous notes on C and C++
Here are some online notes for C and C++ that I made for CSC270 in
Fall 1996. The notes jump around a lot and are in no way
comprehensive. In fact, they don't even include a basic introduction.
Therefore, these notes should be supplemented with a good book. Two
books that I've had experience with are:
- C Programming: A Modern Approach, by K.N. King, about $56.
Used in CSC270. Quite clear and covers many topics.
- On to C, by P.H. Winston, about $25.
An slower introduction with lots of examples. Covers less than King.
There are references to the King book in the notes below. Click on
the headers to get the notes.
See also my page of Useful
Information for more references to C and C++.
James Stewart
King 4.3, 6.4, and page 72
- printf
- pre- and post- increment and decrement
- conditional expressions
- loops and break
King chapter 9
- functions
- function template
- return statement
- parameters
- definition-before-use and `prototypes'
- void functions
King 7.5, 8, 5.3
- conversion between types
- arrays
- switch
King chapters 2.5, 2.6, 9, 10.4
- Constants with #define
- Subtleties of scanf
- more functions
- parameters vs. arguments
- call-by-value
- `scope' of variables
King 8.2, 17.3, 16.1, 16.2, 16.3
- multidimensional arrays
- dynamic allocation of one-dimensional arrays
- structs
- C pointers
- Pointers as function arguments
- Pointers and structs
- Pointers and arrays
- Makefiles (for easier compilation)
- Header files *.h
- Including compilation flags
King 19.4
- Abstract data types
- comments, storage allocation
- classes, public/private
- constructors
- stack example
- calling functions defined in a class
- the special variable `this'
- I/O
King 19.4
- inheritance
- virtual functions
King 19.4
Not in the King book!
- List Node example
- Linked List example
- How to use templates
- How to define templates