Modern C on Sea

Dawid Zalewski

half-day workshop
intermediate
beginner
15:30-19:15, Thursday, 1st July 2021

If you are a seasoned C++ programmer you might think about C as a prehistoric language stuck in the times of K&R. But have you ever heard about compound literals and about how they can be used to enable default function arguments in C? Or have you ever used flexible array members to simplify dynamic data structures creation? What about anonymous unions, designated initialisers or static array arguments? Never heard of those? C is a living language that has much to offer to those who care about performance, who program close to hardware or whose daily routine involves interfacing C++ with C code. If you are such a person, or you are just curious and would like to learn about the older, little brother of C++, this is a workshop for you. We will (re-)discover the perks and perils of modern C. Step by step, we’ll see how leveraging the latest language features helps readability, improves safety and leads to better runtime performance. Who knows, maybe you’ll find writing C enjoyable (again)?

Have a laptop with a recent C-standard compliant toolchain (gcc or clang-llvm) at hand. You’ll need it for exercises.



  1. Quiz (yes we start with an interactive quiz): test your C knowledge. (15 mins)
  2. Arrays: VLA’s and flexible array members, why, why not, and how. (20 mins)
  3. Designated struct and array initialisers. (15 mins) (short break)
  4. Compound literals: (30 mins)
    • Anonymous values — what are they?
    • Applications: pointers, object initialisation, function arguments.
  5. Activity: transform the code (using compound literals and flexible array members and designated initialisers). (15 mins) (short break)
  6. Quiz: what do you know about keywords? (10 mins)
  7. The big five++ keyword differences between C and C++: static, register, inline, auto & restrict. (20 mins)
  8. Anonymous unions and structs. (10 mins)
  9. Activity: transform the code (using safer pointer arguments with static arrays, anonymous unions, bool, compound literals). (15 mins) (optional break)
  10. Exit quiz: what you’ve learned. (15 mins)

All times are approximate.

Dawid Zalewski

Dawid is a computer engineer with a heart for teaching. He's been programming for over 20 years evolving through Basic, Turbo Pascal and many other languages to finally find his home in the land of C++ (with occasional visits to C and Python). He teaches at Saxion University of Applied Sciences in the Netherlands, where he tries to convert new generations of programmers to use modern C++. Besides teaching, he uses C++ in the research on probabilistic state estimation for industrial applications. His interests focus on the design and evolution of programming languages and paradigms. In his free time he explores the evolving landscape of online teaching pedagogy or reads books.