Kindly read Introduction to the C99 Programming Language (Part I) and Introduction to the C99 Programming Language (Part II) before reading this article.
- Addition of Library Functions: C99 provides some Additional Library functions listed below.
Library Function Usage complex.h complex.h supports complex arithmetic fenv.h fenv.h gives access to floating point tags and floating point environments. inttypes.h inttypes.h gives support to handle long numbers (larger width numbers).
It defines a standard, portable integer names
iso646.h iso646.h defines macros corresponds to operators like && and ^ stdbool.h stdbool.h supports boolean data types.
It gives macros like bool, true and false.
stdint.h stdint.h is included in inttypes.h header file.
It gives standard, portable set of integer names.
tgmath.h tgmath.h defines type-generic floating-point macors wchar.h wchar.h supports multibyte and wide character functions. wctype.h wctype.h supports multibyte and wide character classification functions.
- Addition of Format Specifiers: In C99 Standard, printf() and scanf() functions are modified in such a way that they have ability to handle modifiers long long and unsigned long long. The format specifier of long long int is ll and unsigned long long int is ul.
The below sample program demonstrates the use of long long and unsigned long long values.
"Long Number: %lld and"
" Unsigned long: %llu"
- __func__ Identifier:
C99 adds __func__ identifier which returns the name of the function invoked as string. In simple, if __func__ is called in function fun1() then it returns the string fun1.
- Implicit int Declarations:
In C89 standard, we don’t need an explicit declaration of integer return type in functions i.e If we declare function_name(parameters), the compiler will assume the integer as default return type. In C99, All implicit function declarations are no longer supported. Some compiler will raise errors while some shows the same error as warning. GCC compiler shows that as a warning.
- Void Return Types:
In C89 Standard, we can omit return values for functions. If we write int fun1() and execute it without specifying return value, the compiler will execute automatically by taking default return value. This value can either be 0 or garbage value. But in C99, If we write int fun1() without return statement in it then the compiler treats that as an error.
- Extended Integer Types: C99 standard gave several extensions to integer types.
Extended Type Meaning int16_t Integer has exactly 16 bits int_least16_t Integer has at least 16 bits. int_fast32_t Fastest Integer types that has at least 32 bits. intmax_t Holds the Largest Integer Type uintmax_t Holds the Largest unsigned Integer Type
These are generally used rarely.
These are some of the major changes that include addition, change and deletion of features in C89 to get C99 Standard.