CS 102 (Fall '03)
[Schedule]
[Examples] [Programs]
[Notes & Reference]
[Syllabus] [Lab
& TA] [Tests]
[Grades]
| Concept | C |
C++ |
| I/O | printf, scanf | cin, cout (using streams) |
| formatting output | format string, E.g. printf("%5.2f", floatingPointValue); |
setting flags. E.g. |
| Variable declaration | At beginning of each function |
Anywhere in function |
| Variable initialization | Using equals sign, e.g. int x = 3; | Using constructor, e.g. int x(3); |
| Reference Parameters | Pass with &, catch with *, use with * | Catch with & |
| Program name | *.c | *.C or *.cpp or *.cc |
| Creating structure instances | if "struct node" is declared, that subsequent uses also require the type to be "struct node". | Once "struct node" is declared, we can subsequently simply use "node" as the type. |
| Dynamic Memory allocation/deallocation | malloc / free | new / delete |
| Including standard system libraries | #include <stdio.h> |
#include <iostream> |
[CS Dept] [UIC]
[Prof. Reed]