Implicit return type int in C


If some function has no return type, then the return type will be int implicitly. If return type is not present, then it will not generate any error. However, C99 version does not allow return type to be omitted even if it is int.

Example

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

Output

Value is: 20

Updated on: 30-Jul-2019

375 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements