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

In C language, the implicit return type is int

王林
王林forward
2023-08-31 10:41:061233browse

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));
}

Output

Value is: 20

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete