C Programming - Functions - Discussion

Discussion Forum : Functions - True / False Questions (Q.No. 3)
3.
If return type for a function is not specified, it defaults to int
True
False
Answer: Option
Explanation:

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

Discussion:
9 comments Page 1 of 1.

Sparsh said:   1 decade ago
But everytime you declare function you have to specify that it is void, int or float.

How it can be int ?

Jitendra said:   1 decade ago
Please specify a code in which there is a function called with no return type.

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

Rishikesh said:   1 decade ago
Can I declare function float yes/no?

B P Rao said:   10 years ago
Yes you can declare.

Pr@dnya said:   9 years ago
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:   8 years ago
The default return type is void.

Venkat said:   7 years ago
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:   7 years ago
In C the default return type is void. It's int in C++.

Post your comments here:

Your comments will be displayed after verification.