As I mentioned in Chapter 1, a common question is whether to learn C or C++ first. I suggested the best answer may be "neither" - learn Pascal or another "cleaner" language first. This advice is especially important for programmers who have only worked in COBOL, RPG, or other older business languages. C introduces many new concepts, such as data types, scoped variables, static and automatic storage, functions, and dynamic data structures. Unfortunately, in C these concepts are intermixed with machine-level constructs so they are harder to learn and more error-prone than with some other languages. Learning the concepts first in a language like Pascal provides a much better foundation with which to tackle C. In addition, it sets the right frame of mind for avoiding some of the common C idioms that are poor programming practices.
Another language that provides a more rational introduction to C is Awk. Awk has a C-like syntax (it was derived from C), but eliminates some troublesome C elements - most importantly, pointers - and adds easy-to-use, powerful, built-in facilities for string and table handling. One nice aspect of learning Awk, in addition to making the transition to C, is that even when C is used for production programs, Awk provides an excellent "workbench" tool.
Similar advice applies to learning C++ object-oriented programming (OOP) facilities. Learning a language like Smalltalk or Actor, which was designed from the start to support OOP, provides a better introduction than simultaneously trying to learn OOP concepts and C++'s often arcane implementation.
To begin C programming, it's probably advisable to start with a C++ compiler and treat it as "a better C." C++ is rapidly replacing C, and it makes sense to learn the newer C++ facilities (e.g., new instead of malloc(), and the Streams class library instead of the standard C I/O library). On the other hand, a programmer new to C should write several production programs before trying to write any non-trivial C++ classes.
Before a programmer can write complex classes well, he or she needs a deep understanding of the issues that arise when classes are used to define new variables or as super-classes from which member data and functions are inherited. And it requires mastery of both OOP concepts and C++ details before a programmer can write classes that will be shared by other programmers and projects. Certainly any programmer wanting to write C++ classes should have read and fully comprehended the principles in C++ Programming Style by Tom Cargill.updated