我在我的作业代码中看到了这个奇怪的函数定义,但我不知道它的意思。
char *
sh_single_quote (string)
char *string;
{...}
特别是“char *string;”这一行,末尾带有分号。
我在我的作业代码中看到了这个奇怪的函数定义,但我不知道它的意思。
char *
sh_single_quote (string)
char *string;
{...}
这是C语言中函数的K&R风格声明。
在C语言中,通常会将函数写成以下格式:
size_t strlen(const char *str)
{
//code
}
size_t strlen(str) <--- here you write only the param name
const char *str; <--- here you write the type along with param name!
{
//code
}