function with no return type
hello all.
just observe this piece of code
Code:
fun()
{
printf("Hello world");
}
int main()
{
int c = 5;
printf("c = %d\n",c);
c=fun();
printf("c = %d\n",c);
return 0;
}
on compilation and execution usgin gcc, i get the answer as
c = 5
c = 11 (-----> the no of chracters printed by printf())
but since there is no return statement in fun(), the second value of c should contain a junk value.
according to k & r if a function doesnt have a return statement, its return valu is junk value.
but why does c contain the no of characters printed by printf ???