0

I have come across this C sample code and I have no idea what it means:

#include <stdio.h>

int some_int;

int fun (some_int) int* some_int;
{

 return 0;
}

int main()
{
  return 0;
}

Why is fun declared that way and what does it even mean? I can't understand the syntax.

1 Answers1

2
int fun (some_int) int* some_int;
{
   ...
}

is the old (pre ANSI C) way to write this:

int fun (int* some_int)
{
   ...
}

Best you forget about this, unless you need to dig into very old source code.

If you found this in a book, throw it away and get a modern C text book. (Actually don't throw it away but keep it as an antique).

BTW the int some_int; declaration right after #include <stdio.h> is a global variable whose name is totally unrelated to the some_int in the fun function.

This SO article explains it in more details.

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115