My Journey Writing a C Programming Book for the 21st Century

Vedran wrote a modern C textbook after discovering outdated, error-filled resources hindered beginners. This guide offers clear, beginner-friendly prose, practical examples, and multimedia support-helping 21st-century students learn efficiently and accurately. See how he did it inside out.

My Journey Writing a C Programming Book for the 21st Century
Book cover design by Sanjin Halilovic (MoP)

In 2015, when I took my post as an Assistant Professor at an Electrical Engineering college, at a freshman-year course titled "Introduction to Programming" and delivered in C, I never imagined writing a textbook for it. The wealth and quality of literature for the (at the time) 40-year old programming language seemed sufficient. However, by the end of my first year, students petitioned me to do exactly that, both in person and through an anonymous poll.

Naturally, I set out to investigate what was wrong with the recommended literature, so we had a session where I asked students to point out exactly what they found lacking.

{{}}

Problem No. 1: Students lacked previous programming knowledge

Although the EE college has a clear requirement for at least some programming skill, and even though in Bosnia and Herzegovina basic programming is a mandatory part of curriculum for kids aged 10-16, most of my students claimed that this education was useless to them and asked to be treated as a "blank slate" i.e. to start from the beginning.

Here, the problem with C is that it is typically considered a low-level language for professionals, so most textbooks assume at least some degree of programming knowledge in some other language. Students have pointed out that recommended textbooks were impenetrable to them because in their very first paragraphs they used terms and concepts that they had to Google.

One could question the wisdom of delivering an Introduction to Programming course in C. Indeed, it's no secret that this particular EE school is using their freshmen year as a way to weed out the less talented; almost all of the courses contain some subject matter that is considered "hard-core". But it should also be noted that the first year is common for all the departments, including e.g. Automation Control, Electronics, Power Engineering etc. After the Bologna reforms reduced the first degree level to just 3 years, these departments requested that students learn C in the first year.

Problem No. 2: Mistakes Galore

The recommended textbooks were full of factual errors. I was shocked to find that some of the things that I like to bring out as "rookie mistakes" in my lectures were actually presented as the correct way in some of the textbooks. Some research convinced me that writing a textbook on C (and especially C++) that was both factually correct and easy to understand for beginners is a difficult task that many authors have failed spectacularly.

Problem No. 3: Poor Writing

Some of the books simply had a very difficult-to-read prose. As one of the students pointed out, reading the recommended textbook gave her rolling migraines. It seems that many authors of programming textbooks view their work as more of a reference than something that should be read cover-to-cover. They believe that they are doing readers a service by keeping the text short and to the point, "engineering style", but apparently this was disliked by almost all students.

After detecting these problems, I was facing the following requirements for the official course textbook:

  • beginner friendly, assumes no previous knowledge,
  • covers the whole curriculum, which is pretty much all of C except for the preprocessing directives and some third-party libraries,
  • well-written, prose suitable for students aged 18-21,
  • factually correct, with common mistakes and pitfalls pointed out,
  • modern - as far as feasible, giving appropriate focus to software development fundamentals such as writing readable code, proper naming, using comments etc.

My research found no textbooks or publicly available written texts that would cover these basic points. It seems that all of the books that focus on beginners tend to have factual errors and omit aspects of C that was a part of curriculum. Over the years, as a TA on the same course, I gathered a volume of written materials and examples, while my first-year lectures served as a scaffold to organize all this material. Writing the book turned out to be easier then I thought, my co-author took over the two of the most difficult chapters, and so the book was finished by 2018.

On Books and Reading

One comment that I often hear is that "kids these days don't read". Having spent almost two decades working with students aged 18-21, any statement that begins with "kids these days..." is giving me the feeling that they usually describe as "cringe". If anything, I've found that every person is different in their approach to studying and learning. Even if fine literature may be facing a crisis, when it comes to studying there is certainly a large group of young people who prefer to learn from books.

It seems to me that there are several different learning styles, and consequently different media that will give the best effect for learners.

  1. There are students who prefer to learn from written text. They can be divided into two distinct subgroups, those who enjoy reading from screens (e-book readers, phones, laptops), and those who will always prefer an actual paperback or hardcover. As long as this last group remains numerous - and in my experience it definitely is - authors of traditional printed textbooks have nothing to worry about.
    Here I must reiterate the importance of easy and well-written prose. This group of students don't just skim the textbook for reference, they actually immerse themselves into the writing, attempting to soak in not just the tidbits of information that they need to solve a problem, but the whole culture surrounding the subject matter. This is especially the case with programming where learning a certain programming style from a book tends to stick with the reader for years.
  2. The second group of students thrive on oral instruction such as lectures. In the recent decades it has become apparent that dyslexia is more prevalent than previously thought, as it was often mistaken for impaired mental faculties or simply a lower IQ. Students with dyslexia like to listen to speech, but since it is taking more time than reading they prefer to play it at accelerated speed and listen to it while doing other things. For these students, the optimal medium for learning is a video or audio recording (such as a recording of lectures) that they can play as they like on their phone.
  3. A sizable group of students likes having organized information. They typically already have some knowledge and want to skip to the parts they don't know to optimize their time. This group of students enjoys having bullet-point presentations and various indices and tables of content.
  4. Most students learn visually. Preparing quality visualizations takes a lot of time, but it's an effort that pays the most in terms of student success.
  5. Finally, many students (myself included) require an example that they can tear apart and analyse. In other sciences this role may be taken by experiments that students can run in their own time. A positive aspect of programming is that running experiments doesn't require a lab, expensive equipment, or willing participation of other people, so learning can be easy - but someone still has to prepare working examples.
    "Learning by doing" is a variation of this idea where the example is not worked, instead students are expected to develop it themselves with some guidance. The equivalent in other sciences would be an experiment where students are given only an initial formula and the expected outcome.
    This approach, however, is fairly unpopular since it creates a sizable and constant burden on the teaching staff. Writing a book, preparing lectures or an instruction video are, after all, one-off tasks. One particular problem is that students often misunderstand assignments and deviate from the intended task, with the consequence that they will not learn the intended lesson. If the student doesn't receive the needed assistance, a lot of them will resort to copying the solution from someone else even when there are no points awarded for correct solutions or punishment for no solution.
    Nowadays, in programming lessons, AI assistants can help students as they solve tasks. Automated tests can reveal if the student properly understood the assignment. Plagiarism detection can keep the students honest and discourage them from copying the solution.

"Introduction to Programming" Learning Platform

After finishing the textbook my goal became to offer instruction material that supports all of the above learning styles, transcending the book into different media. My idea of a textbook for the 21st century is that it is not just a paperback - it is a gateway to an online resource center where different media for instruction will be found. This is an enormous task that will for sure never be truly finished. Nonetheless I embarked on it as part of my teaching position, and am slowly (as time permits) integrating various parts of my work into an online website accessible through a unique code that can be found printed inside the book covers.

Currently, when you buy the book you are getting:

  1. The book itself, in printed and digital form useful for ebook readers.
  2. My lecture slides provide a bullet-point list of topics presented in the book and serve as a sort of index to book contents. Also, the book itself contains an index of programming terms.
  3. 140 worked and unworked programming examples. A web-based IDE allows easy access to all of these, and a way to test if the solution is correct using automated tests.
  4. During COVID-19 I delivered all my lectures online, recordings are available. They need to be sorted, though, and possibly some of them need to be re-recorded.
  5. A code reading game provides snippets of code and asks the player to guess what the program will output, allowing to collect points, streaks etc.
  6. Another gamification approach developed during the COVID-19 pandemic is "UUP Game" which gives programming tasks to the player with increasing complexity, with correct solutions the player is awarded with XP that they can trade for various powerups that make playing easier (such as hints towards the solution).

The aspect of visualizations is currently the most lacking. There are some visualizations in the form of slides, but this is of course not ideal. Another large task is to translate everything into English. I hope to soon finish this work and present the entire multimedia experience to the English-speaking audience.

Final Thoughts

Writing this textbook was never part of the original plan - it emerged from necessity, curiosity, and, above all, a desire to help students succeed. What began as a response to their struggles became a deeply personal and rewarding journey. In the process, I learned that even a mature language like C still needs fresh, accessible resources tailored to modern learners. More importantly, I saw firsthand how responsive and engaged a learning community can be when given tools that speak their language. Creating new content isn't just about filling gaps in existing literature; it’s about contributing to a living ecosystem of shared knowledge. Therefore, I hope this book serves as a resource, but also as an example that education flourishes when we commit to listening, adapting, and building together.