C Programming Language Standard


In this problem, we will learn about the standards that are defined in the C programming language. These are those standard ways in which the program is to be ideally compiled by the compiler as defined by the development community.

To understand what I am saying take an easy example of a common C program that you all must have encountered and have seen the issue coming but haven’t got deep into it.

The main() function’s void return type −

See the following program −

void main() {
   //program code
}

This program will run ok if we use the turbo c compiler but other compilers throw an error that the main cannot be void. So, which one is correct? The answer is mentioned in the standards.

What is the C programming language standard?

It is the standard way defined for the compiler creators about the compilation of the code. The latest C standard was released in June 2018 which is ISO/IEC 9899:2018 also known as the C11.

This C programming language standard defines the behavior of the program i.e How the program will ideally run? What are the correct ways and definitions of some in-built functions?

Let’s see the example of main(), the standard way of declaring the main() function as depicted is with 0 or 2 parameters and with a return type of int.

Syntax

// No parameter
int main() {
   /* code */
}
// Two parameter
int main(int argc, char *argv[]) {
   /* code */
}

There are a lot more standards in programming that might be violated by some compilers.

Updated on: 05-Aug-2020

923 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements