I came across this C program in a blog post:
main()
{
int n;
n = 151;
f(n);
}
f(x)
int x;
{
printf("%d.\n", x);
}
The post doesn't explain it. Can anybody explain what this weird function definition means?
This is the K&R style of C code, it's still valid C syntax, but I suggest you not using it in new-written code.
f(x)
int x;
is equivalent to ANSI C:
void f(int x)
K&R C is the C language described in the first edition of the book C programming language by Brian Kernighan and Dennis Ritchie, and named after the two authors. The second edition of the book updated to use ANSI C.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With