C99 has been around for over 10 years, but support for it has been slow coming, so most developers have stuck with C89. Even today, I'm sometimes mildly surprised when I come across C99 features in C code.
Now that most major compilers support C99 (MSVC being a notable exception, and some embedded compilers also lagging behind), I feel that developers who work with C probably ought to know about what C99 features are available to them. Some of the features are just common features that were never standardized before (snprintf
, for instance), or are familiar from C++ (flexible variable declaration placement, or single-line //
comments), but some of the new features were first introduced in C99 and are unfamiliar to many programmers.
What do you find the most useful new features in C99?
For reference, the C99 standard (labelled as a draft, but identical to the updated standard, as far as I know), the list of new features, and the GCC C99 implementation status.
One feature per answer, please; feel free to leave multiple answers. Short code examples demonstrating new features are encouraged.