0

I've read an interesting code recently, but I can not identify the meaning of it:

void foo(arg1, arg2)
int arg1;
unsigned char arg2[16];
{
    //some code
}

I have never seen something like that in C language before as function argument declaration and definition. I am develping software since 2003, but it is something like either old or brand new stuff. What kind of function definition style is it? As I remember, you could declare the arguments in Pascal that way, but not in C.

Andrew

  • Look here: http://syque.com/cstyle/ch6.16.htm. Also, there is a question with compilable Old C-style code: http://stackoverflow.com/questions/4581586/old-style-c-function-declaration – izogfif Mar 28 '13 at 08:22

2 Answers2

1

This equals to:

 void foo(int arg1, unsigned char arg2[16]) 
 {

It's very old style.

TieDad
  • 9,143
  • 5
  • 32
  • 58
1

It's original pre-ANSI C, like shown in K&R1 (the original edition of "The C Programming Language" by Kernighan and Ritchie. So-called "primordial" or pre-ANSI C compilers used this syntax. Some modern compilers can be invoked so that they will accept this type of code with command line options.

C has evolved a long way since then, but you still encounter it occasionally in older programs.

Randy Howard
  • 2,165
  • 16
  • 26