Search code examples
cfunctionprogram-entry-point

Assigning Data type to a User Defined Function


I'm new to programming and I was pondering about it.

In C language when a Function is declared by the user. What happens if the data type of the function is not assigned. My question is basically that what is the difference between a function like these:

int main()
{
    statements.....
}

main()
{
    statements.....
}

what happens if we assign the data type? what happens if we don't? Any help. Please Thank You.


Solution

  • It's referred to as the implicit int rule. Essentially, it assumes it's an int. Though this is not in the C standard (as of C99).

    See here for a more detailed answer.