这个奇怪的C++定义是什么意思?

Fra*_*era 3 c kr-c function definition

我的作业代码中有这个奇怪的函数定义,我真的不知道它应该是什么意思.

char *
sh_single_quote (string)
char *string;
{...}
Run Code Online (Sandbox Code Playgroud)

特别是"char*string;" 一行,最后用分号.

Naw*_*waz 5

它是C语言中函数的K&R样式声明.

在C中,您通常编写一个函数:

size_t strlen(const char *str)
{
    //code
}
Run Code Online (Sandbox Code Playgroud)

在K&R风格中,这将写成:

size_t strlen(str)  <--- here you write only the param name
const char *str;    <--- here you write the type along with param name!
{
   //code
}
Run Code Online (Sandbox Code Playgroud)