Home > Article > Backend Development > C language standard
In this question, we will learn about the standards defined in C programming language. These are standard ways of compiling programs ideally for a compiler defined by the development community.
To understand what I am talking about, take a common C program as an example. You must have encountered and seen the problem, but did not study it in depth.
void return type of main() function-
Look at the following program-
void main() { //program code }
If we use the turbo c compiler, this program can Works fine, but other compilers throw errors that main cannot be void. So, which one is correct? The answers are all mentioned in the standards.
It is the standard way of doing things for the C language as defined by the compiler creators. Compilation of code. The latest C standard was released in June 2018, ISO/IEC 9899:2018, also known as C11.
This C programming language standard defines the behavior of a program, i.e. How does a program run under ideal circumstances? What are the correct methods and definitions of some built-in functions?
Let's look at the example of main(). The standard way of declaring the main() function is with 0 or 2 parameters and a return type of int.
// No parameter int main() { /* code */ } // Two parameter int main(int argc, char *argv[]) { /* code */ }
Some compilers may violate further programming standards.
The above is the detailed content of C language standard. For more information, please follow other related articles on the PHP Chinese website!