Home > Backend Development > C++ > body text

C language standard

王林
Release: 2023-08-26 10:37:06
forward
1590 people have browsed it

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
}
Copy after login

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.

What is the C programming language standard?

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.

Syntax

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

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template