Teaching C and C++
by Slobodan Dmitrović
I have been working as a software developer for 20 years, and I understand the significance of proper education in learning programming languages. Learning a new language may be challenging for people who have never programmed before but also for the experienced developers who are upgrading to new versions. This is why I have decided to share my knowledge by facilitating training and publishing technical books.
Teaching C and C++
Choosing the right method of presenting information is crucial for learning C and C++ programming languages.
My initial focus is to build a solid base in which we avoid details and irrelevant vocabulary and only cover some of the topics. The purpose of the base is to provide the foundation for further learning and to enable progress. Some languages can be learned by trial-and-error technique, but C and C++ cannot be learned by playing a guessing game. People are often afraid of these languages, which is why my two introductory books for C and C++ offer the basics of the programming languages in a concise manner.
When teaching C++, I start with types, operators, and expressions, then move on to statements and built-in statements. Although the use of raw character arrays and raw pointers is discouraged nowadays, in “Modern C++ for Absolute Beginners: A Friendly Introduction to the C++ Programming Language and C++11 to C++20 Standards,” I briefly explained them as well. Then we move to functions and classes. We start with an empty class, class data members, and then move on to member functions. Only then do we introduce the copy and move semantics and briefly touch on the operator overloading. Prior to explaining the C++ Standard Library fundamentals, the reader should get familiar with strings, smart pointers, major modern C++ facilities, and templates. The next step is to introduce the reader to the C++ Standard Library, followed by an introduction to modern C++ standards.
Teaching C is a different ball game. Unlike in modern C++, where the use of raw pointers and arrays is discouraged, C constructs heavily rely on bytes, raw arrays, and pointers manipulation. It is therefore important to emphasize that C and C++ are two different programming languages, and they should not be confused.
My newest book, “Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language”, is an attempt to present the C programming language through a delicate balance of theory and practice. Programmers like examples, and that is why the majority of the chapters are followed by examples, which range from the simplest to the more complex ones.
The first part of the book introduces the language, then it moves to a standard library, where we learn about the useful libraries that come with a C compiler. The third part of the book tackles modern C standards, such as C11 and C2x, and we explore the novelties that are introduced by applying these standards. The fourth part of the book provides tips and tricks of the standard practice.
My aim is to provide precise and concise information, followed by generic examples, which become more complex as we progress. I hope both of the books help change the perspective and show the elegance, strength, and beauty of these languages.
About the Author
Slobodan Dmitrovic is a software consultant, professional C and C++ trainer, and experienced team leader. Slobodan’s company, “Clear Programming Paradigm,” provides education, training, and outsourcing services.
This article was contributed by Slobodan Dmitrovic, author of Modern C for Absolute Beginners.