Open In App
Related Articles

C Programming Language Standard

Improve Article
Save Article
Like Article


The C programming language has several standard versions, with the most commonly used ones being C89/C90, C99, C11, and C18.

  1. C89/C90 (ANSI C or ISO C) was the first standardized version of the language, released in 1989 and 1990, respectively. This standard introduced many of the features that are still used in modern C programming, including data types, control structures, and the standard library.
  2. C99 (ISO/IEC 9899:1999) introduced several new features, including variable-length arrays, flexible array members, complex numbers, inline functions, and designated initializers. This standard also includes several new library functions and updates to existing ones.
  3. C11 (ISO/IEC 9899:2011) introduced several new features, including _Generic, static_assert, and the atomic type qualifier. This standard also includes several updates to the library, including new functions for math, threads, and memory manipulation.
  4. C18 (ISO/IEC 9899:2018) is the most recent standard and includes updates and clarifications to the language specification and the library.

When writing C code, it’s important to know which standard version is being used and to write code that is compatible with that standard. Many compilers support multiple standard versions, and it’s often possible to specify which version to use with a compiler flag or directive.

Here are some advantages and disadvantages of using the C programming language:


  1. Efficiency: C is a fast and efficient language that can be used to create high-performance applications.
  2. Portability: C programs can be compiled and run on a wide range of platforms and operating systems.
  3. Low-level access: C provides low-level access to system resources, making it ideal for systems programming and developing operating systems.
  4. Large user community: C has a large and active user community, which means there are many resources and libraries available for developers.
  5. Widely used: C is a widely used language, and many modern programming languages are built on top of it.


  1. Steep learning curve: C can be difficult to learn, especially for beginners, due to its complex syntax and low-level access to system resources.
  2. Lack of memory management: C does not provide automatic memory management, which can lead to memory leaks and other memory-related bugs if not handled properly.
  3. No built-in support for object-oriented programming: C does not provide built-in support for object-oriented programming, making it more difficult to write object-oriented code compared to languages like Java or Python.
  4. No built-in support for concurrency: C does not provide built-in support for concurrency, making it more difficult to write multithreaded applications compared to languages like Java or Go.
  5. Security vulnerabilities: C programs are prone to security vulnerabilities, such as buffer overflows, if not written carefully.
    Overall, C is a powerful language with many advantages, but it also requires a high degree of expertise to use effectively and has some potential drawbacks, especially for beginners or developers working on complex projects.


important for several reasons:

  1. Choosing the right programming language: Knowing the advantages and disadvantages of C can help developers choose the right programming language for their projects. For example, if high performance is a priority, C may be a good choice, but if ease of use or built-in memory management is important, another language may be a better fit.
  2. Writing efficient code: Understanding the efficiency advantages of C can help developers write more efficient and optimized code, which is especially important for systems programming and other performance-critical applications.
  3. Avoiding common pitfalls: Understanding the potential disadvantages of C, such as memory management issues or security vulnerabilities, can help developers avoid common pitfalls and write safer, more secure code.
  4. Collaboration and communication: Knowing the advantages and disadvantages of C can also help developers communicate and collaborate effectively with others on their team or in the wider programming community.

The idea of this article is to introduce C standard. 

What to do when a C program produces different results in two different compilers? 
For example, consider the following simple C program. 


void main() {  }

The above program fails in GCC as the return type of main is void, but it compiles in Turbo C. How do we decide whether it is a legitimate C program or not? 

Consider the following program as another example. It produces different results in different compilers. 


// C++ Program to illustrate the difference in different
// compiler execution
#include <stdio.h>
int main()
    int i = 1;
    printf("%d %d %d\n", i++, i++, i);
    return 0;

2 1 3 - using g++ 4.2.1 on Linux.i686
1 2 3 - using SunStudio C++ 5.9 on Linux.i686
2 1 3 - using g++ 4.2.1 on SunOS.x86pc
1 2 3 - using SunStudio C++ 5.9 on SunOS.x86pc
1 2 3 - using g++ 4.2.1 on SunOS.sun4u
1 2 3 - using SunStudio C++ 5.9 on SunOS.sun4u

Source: Stackoverflow
Which compiler is right?
The answer to all such questions is C standard. In all such cases, we need to see what C standard says about such programs.

What is C standard? 
The latest C standard is ISO/IEC 9899:2018, also known as C17 as the final draft was published in 2018. Before C11, there was C99. The C11 final draft is available here. See this for a complete history of C standards.

Can we know the behavior of all programs from C standard? 
C standard leaves some behavior of many C constructs as undefined and some as unspecified to simplify the specification and allow some flexibility in implementation. For example, in C the use of any automatic variable before it has been initialized yields undefined behavior and order of evaluations of subexpressions is unspecified. This specifically frees the compiler to do whatever is easiest or most efficient, should such a program be submitted.

So what is the conclusion about above two examples? 
Let us consider the first example which is “void main() {}”, the standard says following about prototype of main().

The function called at program startup is named main. The implementation 
declares no prototype for this function. It shall be defined with a return
type of int and with no parameters:
int main(void) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names
may be used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }
or equivalent;10) or in some other implementation-defined manner.

So the return type void doesn’t follow the standard, and it’s something allowed by certain compilers.

Let us talk about the second example. Note the following statement in C standard is listed under unspecified behavior.  

The order in which the function designator, arguments, and 
subexpressions within the arguments are evaluated in a function
call (

What to do with programs whose behavior is undefined or unspecified in standard? 
As a programmer, it is never a good idea to use programming constructs whose behavior is undefined or unspecified, such programs should always be discouraged. The output of such programs may change with the compiler and/or machine.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 25 Aug, 2023
Like Article
Save Article
Similar Reads