History of C & C++
C was invented and first implemented by Dennis Ritchie on a DEC PDP-11 that used the Unix operating system.For many years, the de facto standard for C was the version supplied with the Unix version 5 operating system. It was first described in The C Programming Language by Brian Kernighan and Dennis Ritchie (Englewood Cliffs, N.J.: Prentice-Hall, 1978). In the summer of 1983 a committee was established to create an ANSI (American National Standards Institute) standard that would define the C language once and for all.The standardization process took six years (much longer than anyone reasonably expected). The ANSI C standard was finally adopted in December 1989, with the first copies becoming available in early 1990. The standard was also adopted by ISO (International Standards Organization) and is now referred to as the ANSI/ISO C standard. For simplicity, this book will use the term Standard C when referring to the ANSI/ISO C standard. Today, all mainstream C/C++ compilers comply with Standard C. Standard C is the foundation upon which C++ is built.
C Is a Middle-Level Language
C Is a Middle-Level Language C is often called a middle-level computer language. This does not mean that C is less powerful, harder to use, or less developed than a high-level language such as BASIC or Pascal, nor does it imply that C has the cumbersome nature of assembly language (and its associated troubles). Rather, C is thought of as a middle-level language because it combines the best elements of high-level languages with the control and flexibility of assembly language.
Highest level Ada Modula-2 Pascal COBOL FORTRAN BASIC
Middle level Java C++ C FORTH
Lowest level Macro-assembler Assembler
All high-level programming languages support the concept of data types. A data type defines a set of values that a variable can store along with a set of operations that can be performed on that variable. Common data types are integer, character, and real. Although C has five basic built-in data types, it is not a strongly typed language, as are Pascal and Ada. C permits almost all type conversions. For example, you may freely intermix character and integer types in an expression.
Another important aspect of C is that it has only 32 keywords (27 from the Kernighan and Ritchie de facto standard, and five added by the ANSI standardization committee), which are the commands that make up the C language. High-level languages typically have several times more keywords. As a comparison, consider that most versions of BASIC have well over 100 keywords!
The 32 keywords that, combined with the formal C syntax, form the C programming language. Of these, 27 were defined by the original version of C. These five were added by the ANSI C committee: enum, const, signed, void, and volatile. All are, of course, part of the C++ language.
Understanding the .C and .CPP File Extensions
The programs in Part One of this book are, of course, valid C++ programs and can be compiled using any modern C++ compiler. They are also valid C programs and can be compiled using a C compiler. Thus, if you are called upon to write C programs, the ones shown in Part One qualify as examples. Traditionally,C programs use the file extension .C, and C++ programs use the extension .CPP. A C++ compiler uses the file extension to determine what type of program it is compiling. This is important because the compiler assumes that any program using the .C extension is a C program and that any file using .CPP is a C++ program.
The Library and Linking
You can create a useful, functional C or C++ program that consists solely of the statements that you actually created. However, this is quite rare because neither C nor C++ provides any keywords that perform such things as input/output (I/O) operations, high-level mathematical computations, or character handling. As a result, most programs include calls to various functions contained in the standard library. All C++ compilers come with a standard library of functions that perform most commonly needed tasks. Standard C++ specifies a minimal set of functions that will be supported by all compilers. However, your compiler will probably contain many other functions. For example, the standard library does not define any graphics functions, but your compiler will probably include some. The C++ standard library can be divided into two halves: the standard function library and the class library. The standard function library is inherited from the C language. C++ supports the entire function library defined by Standard C. Thus, all of the standard C functions are available for use in C++ programs that you write.Standard library can import in program by writing using namespace std;
Comments
Post a Comment