Hi,
I'm really confused about the need for declaring a function in C.
When I write(define) a function of this type
Code:
int fun(int, int, ...); or
void fun(int, int..)
there is no need for any declaration. Direct definition would do.
But the moment, the return type/ any of the arguments is not void/int, it gives me an error message indicating the need for declaration. For example
Code:
int fun(float a)
{
printf("\nFloat value = %f",a);
}
This function needs a declaration like
Why is this ?
Thanks
PS : Throughout the post, I am talking about definitions after main. If definitions were written before main, there is no need for any declarations,right. Just a disclaimer.
Bookmarks