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:
There are references to the King book in the notes below. Click on
the headers to get the notes.
- 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.
See also my page of Useful
Information for more references to C and C++.
King 4.3, 6.4, and page 72
King chapter 9
- pre- and post- increment and decrement
- conditional expressions
- loops and break
King 7.5, 8, 5.3
- function template
- return statement
- definition-before-use and `prototypes'
- void functions
King chapters 2.5, 2.6, 9, 10.4
- conversion between types
King 8.2, 17.3, 16.1, 16.2, 16.3
- Constants with #define
- Subtleties of scanf
- more functions
- parameters vs. arguments
- `scope' of variables
- multidimensional arrays
- dynamic allocation of one-dimensional arrays
- C pointers
- Pointers as function arguments
- Pointers and structs
- Pointers and arrays
- Makefiles (for easier compilation)
- Header files *.h
- Including compilation flags
- Abstract data types
- comments, storage allocation
- classes, public/private
- stack example
- calling functions defined in a class
- the special variable `this'
Not in the King book!
- virtual functions
- List Node example
- Linked List example
- How to use templates
- How to define templates