Notes on the difference between C an C++
You may hear from time to time that the C++ programming language is a superset of the C language. In C++, you can do almost everything you can do in C, with the exception of just a small number of things that may be considered specification details. Nonetheless, C and C++ are two different languages. One of the important points I'd like to make is that it is not desired to write C programs in a C++ compiler, although it is possible. We would rather stick to a C compiler if we wanted to write a C program, as we would use a C++ compiler to write a program in C++.
Why was it named C++?
Initially the C++ language was named "C with Classes" because you could still write C-like programs in C++ but you could also use what we call classes. I will be sure to talk about classes and other object-oriented C++ concepts in the following tutorials. You might ask, why a successor to C is called C++ and what is this double plus sign business all about? If you were writing a program in C and you wanted to add two numbers together such as 1 + 1, in the listing (or source code) of your program, you would write it just that way as: 1 + 1. Notice that in computer programming, the plus sign is called an operator, it directs the compiler to add two values together. Plenty of times programmers need to add the digit 1 to another digit stored in what is called a variable. Because of the frequent use of these simple arithmetics in general computer programs, a new operator called postfix increment (represented by a double plus sequence: ++) may be used to simply add 1 to the existing value, thus avoiding the redundancy of typing: 1 + 1. It just makes the program code look cleaner and easier to read. Therefore, you can see that the expression C++ actually has a meaning. It is C incremented by 1, or in other words, a version of C programming language that contains additional features. You may also think of C++ as an augmented version of C.
On the other hand, the reason the C programming language is called C, is that it is a successor to the language called B. Simple isn't it? Strange as it is, there was never a programming language called A. Or as far as we know, if there was a language called A, it never saw the light of success or popularity. If you are interested in learning about how C++ falls into the history of computer programming languages, you may want to look at the chart of evolution of computer languages. This hierarchy shows where each computer language came from. As you can see the Assembly Language (which is a low-level programming language) on this chart is located in the upper left corner because it is one of the first languages ever designed and can be considered the grand-father of all computer programming languages. Additionally you may be able to gain an insight from the list of programming languages by date that lists languages in chronological order.
The History of C++
And so, with the help of the previous few paragraphs we can move on. Let's review. C++ came from C. C was developed after the language called B (designed by Ken Tompson in 1970). B itself came from another language called BCPL (developed by Martin Richards). There wasn't a language A, but there was indeed a language called the assembly language which was in close proximaty to working with the machine code.
In 1972, Ken Tompson and Dennis Ritchie created an improved version of the B language, and named it C. C wasn't popular among programmers until a (now considered a classic) book called The C Programming Language (Prentice Hall Software) was released. This book was written by Brian W. Kernighan and Dennis Ritchie. Just about every experienced C programmer has learned C from this book. According to Amazon's book-store description: unlike many of the 1,000 page doorstops stuffed with CD-ROMs that have become popular, this volume is concise and powerful (if somewhat dangerous) -- like C itself. People sometimes refer to C as a dangerous language because you can crash your computer with it. This is because C gives you a tremendous amount of power over memory management while still remaining somwhat high-level and easy to program in than say, the assembly language.
B got its start on a UNIX-operated system, by today's standards a prehistoric computer called DEC PDP-7. And so when C was released it was still used in a UNIX environment. All of these happenings were taking place before the the rise of microcomputers followed by a Personal Computer (PC) revolution in 1981. As the number of produced Personal Computers increased so did the number of C programmers. Today, C is not as popular of a language as it used to be on either UNIX or Windows Operating Systems, but it is not forgotten. Veteran programmers still use C for System Programming, hardware and other low-level code. In a way, C was like an easier to use assembly language to programmers who were experienced with the internal workings of a microprocessor. They enjoyed how easy it was to learn the language and the amount of control over computer it gave them.
ANSI makes C a Standard
When C started to become an extremely popular language, plenty of companies began to offer their own versions of C. These companies had a different direction in which they were moving the language. No longer could the programmers, using different versions of C, write compatible code. The American National Standards Institute (ANSI) solved this problem by creating a subcommittee named X3J11. This committee's purpose was to standardize the C programming language, and so they did. The official standard language name was pronounced ANSI C, or Standard C. It no longer mattered which company's version of C programmers were using, the language features were reliable and available in all existing versions of compiler software that was based on the ANSI C standard specification.
The birth of C++
In the coming two years after C was released, the code written in C began to suffer from a problem. As the programmers harnessed the power of Personal Computer, the software grew more complex, and the C programs have gotten longer and longer. This meant that these programs were also harder to maintain. Some functions needed to communicate with other functions, but there was no standard way of thinking about data organization. In long programs, the code was practically infested with functions in the global scope. One of the few ways to separate data was by using separate C header (.h) and C source (.c) files. Other than that, the language's features that would help organize the code to ensure readability of large programs were simply missing.
There had to be a solution. In 1983, Bjarne Stroustrup developed such a solution, and named it the C++ programming language. He drew inspiration from some of the previous languages that allowed object-oriented programming. One of those languages was Simula67. It can be said that one of the greatest addition to C's supset, the C++ language, was that C++ introduced programmers to the concept of an object. An object is an abstraction of a problem. Not only does the use of the concept of objects in a programming language reduce the size of the program, it also makes the program much more readable and compact. The notion of objects gave the origin to the concept of Object-Oriented programming which I discuss in my Introduction to Object-Oriented Programming.