Authors: Douglas Wilhelm Harder and Prof. Patel
In many cases, when programming real-time, embedded or operating systems, the memory overhead of C++ can be unnecessarily excessive. Consequently, embedded systems and operating systems (and some larger real-time systems) are still programmed in C. This section will look at the differences between C and C++. There are some aspects of C++ that are not available in C, such as
You may therefore observe that while C++ is primarily object-oriented, C is procedural, meaning that you solve problems by determining the appropriate sequence of function calls, as opposed to object-oriented programming where you solve problems by determining what manipulations must be performed on what data.
Now, that is not to say that you cannot use an object-oriented approach in C; it is only that there are no language features to assist or enforce an object-oriented approach. For example, you can choose to only access the member variables of a structure through function calls, but there is no mechanism in place to prevent you from accidentally accessing a member variable when you meant to use a function call.
The topics in this section will give you the initial tools you will need to program in C, as opposed to C++, including