If possible please provide syntax how pass argument implicitly and explicitly.
Okay, but remember that the current C standard doesn't allow implicit parameter types.
Your program is using explicit parameter and return types. Implicit follows (note using C98 standard):
Code:
#include<stdio.h>
/* Notice no function prototype */
int main()
{
int a = 10, b = 20, sum;
sum = add(a,b);
printf("Addition = %d", sum);
/* In C98 you should explicitly return an int from this function
the compiler doesn't implicitly return zero, unlike the current
standard.
Also note that the C98 standard doesn't allow C++ type of comments.
*/
return 0;
}
/* Implicit return type and implicit type for x. Explicit type for y. */
add (x, int y)
{
int total;
total = x + y;
return (total);
}
Because of the lack of a function prototype the compiler will assume that the function returns an int, that there can be any number of arguments, and that all the arguments will be of type int. This is referred to as an implicit function declaration.
Now to the function implementation. By removing the explicit return type you now have an implicit return type, the compiler will assume the function returns an int. The same with the implicit parameter, the compiler will also assume that the argument is of type int.
Jim