From C to C++
In this chapter we do a quick transition from C to C++, treating C++ as an extension of ANSI-C [Joh93]. It will enable readers to write very simple C++ programs.1 As stated in the introduction, the description of the language does not cover all the details: the syntax definitions are incomplete with respect to the language definition; they are complete, however, in the sense that they contain all the applications which can be found in this book. In Sect. 2.1 we introduce some notation to be used throughout this volume. In Sect. 2.2 we explain the basic principles for compilation and in Sect. 2.3 we show simple function calls. Some C++ extensions to C declaration syntax are listed in Sect. 2.4. In the remaining sections of this chapter we describe basic features of C and set them in a new context for C++. Sect. 2.5 describes standard formatted input and output which is part of the C programming language and available in C++ as well. Basic data types, the main program, function definition, and scope are described in the final sections.
Unable to display preview. Download preview PDF.