Tuesday, 15 January 2013

The C99 Standard

  C99 is an informal name for ISO/IEC 9899:1999, a past version of the C programming language standard. The latest standard is called C11. Even though there are standards like C99 and C11, the most widely supported C standard is still ANSI C. Here in this post I am discussing the differences between ANSI C and C99.
  • inline, restrict, _Bool, _Complex and _Imaginary are the new keywords introduced by C99.
  • _Bool, long long, _Imaginary and _Complex are the new data types included by C99.
  • long long has 64 bit precision.
  • Declarations can be mixed with other statements.
                     int x;
                     printf ("\nx is %d",x);
                     int y=20;   //Valid in C99, but error in ANSI C.
  • Declarations within for loop is allowed.
                    for(int i=0;i<10;i++)  //Valid in C99, but error in ANSI C.
  • Variable length arrays are supported in C99.
  • Variable length macro arguments are allowed in C99.
  • true and false are predefined macro constants in C99.
  • Return type is no longer integer by default.
  • Unicode characters are supported by C99. \u or \U followed by hexadecimal numbers will print Unicode characters.
  • Single line comments ( // ) in C++ are supported by C99.
  • Compound literals are supported by C99 which are used instead of temporary arrays used in function calls.

No comments:

Post a Comment