C Programming - Functions - Discussion

3. 

If return type for a function is not specified, it defaults to int

[A]. True
[B]. False

Answer: Option A

Explanation:

True, The default return type for a function is int.


Sparsh said: (Mar 12, 2013)  
But everytime you declare function you have to specify that it is void, int or float.

How it can be int ?

Jitendra said: (Jul 29, 2014)  
Please specify a code in which there is a function called with no return type.

Aman said: (Aug 30, 2014)  
The given answer (i.e., True) corresponds to the pre C99 era. It is no longer valid.

Rishikesh said: (Oct 30, 2014)  
Can I declare function float yes/no?

B P Rao said: (Oct 8, 2015)  
Yes you can declare.

Pr@Dnya said: (Jun 22, 2016)  
The int is the main () function's return type. That means that the kind of value main () can return is an integer.

Void main () is not a standard form, some compilers allow this, but none of the standards have ever listed it as an option. Therefore, compilers don't have to accept this form and several don't. Again, stick to the standard form, and you won't run into problems if you move a program from one compiler to another.

Dipali said: (Aug 5, 2017)  
The default return type is void.

Venkat said: (Mar 2, 2018)  
The default return type is int.

OS will collect the default integer value that is 0.
According to me, that is programmer choice, but compiler default will return an integer.

Mahima Awasthi said: (Jul 26, 2018)  
In C the default return type is void. It's int in C++.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.