Home > Backend Development > C++ > In C language, the implicit return type is int

In C language, the implicit return type is int

王林
Release: 2023-08-31 10:41:06
forward
1267 people have browsed it

In C language, the implicit return type is int

If a function has no return type, the return type will default to int. If no return type is specified, no error is generated. However, even if the return type is int, the C99 version does not allow the return type to be omitted.

Example

#include<stdio.h>
my_function(int x) {
   return x * 2;
}
main(void) {
   printf("Value is: %d", my_function(10));
}
Copy after login

Output

Value is: 20
Copy after login

The above is the detailed content of In C language, the implicit return type is int. 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