3

I have this strange function definition in my homework code and I don't really know what it's supposed to mean.

char *
sh_single_quote (string)
char *string;
{...}

Especially the "char *string;" line, what with the semicolon at the end.

Yakk - Adam Nevraumont
  • 262,606
  • 27
  • 330
  • 524
  • 2
    Old style C function declaration. [Look here.](http://stackoverflow.com/questions/4581586/old-style-c-function-declaration) – yattering Mar 13 '13 at 14:46

1 Answers1

5

It is K&R style declaration of a function in C language.

In C, you usually write a function as:

size_t strlen(const char *str)
{
    //code
}

In K&R style this will be written as:

size_t strlen(str)  <--- here you write only the param name
const char *str;    <--- here you write the type along with param name!
{
   //code
}
Nawaz
  • 353,942
  • 115
  • 666
  • 851