c中的这两个声明有什么区别?

时间:2021-06-26 22:27:28
typedef int F1(int x);

int F1(int x);

Seems the same to me,either with typedef or not..

对我来说都是一样的,不管是用typedef还是不用。

2 个解决方案

#1


6  

typedef doesn't declare a variable; it declares a type.

typedef不声明变量;它声明一个类型。

After you say:

后你说:

typedef int F1(int x);

later in your code you can have this:

在后面的代码中,您可以得到以下内容:

F1 myfunction;

which is equivalent to:

相当于:

int myfunction(int x);

#2


6  

typedef int F1(int x);

You define a function type F1 which is function taking a integer as argument and returning an integer

您定义了一个函数类型F1,该函数将一个整数作为参数,并返回一个整数。

int F1(int x);

You define a function which is called F1

定义一个名为F1的函数

#1


6  

typedef doesn't declare a variable; it declares a type.

typedef不声明变量;它声明一个类型。

After you say:

后你说:

typedef int F1(int x);

later in your code you can have this:

在后面的代码中,您可以得到以下内容:

F1 myfunction;

which is equivalent to:

相当于:

int myfunction(int x);

#2


6  

typedef int F1(int x);

You define a function type F1 which is function taking a integer as argument and returning an integer

您定义了一个函数类型F1,该函数将一个整数作为参数,并返回一个整数。

int F1(int x);

You define a function which is called F1

定义一个名为F1的函数