What is the difference between the two declarations in c?

typedef int F1(int x);

int F1(int x);

The same for me, either with help typedefor not.

+3
source share
2 answers

typedefdoes not declare a variable; he declares a type.

After you say:

typedef int F1(int x);

further in your code you can do this:

F1 myfunction;

which is equivalent to:

int myfunction(int x);
+6
source
typedef int F1(int x);

You define the type of function F1, which is a function that takes an integer as an argument and returns an integer

int F1(int x);

You define a function called F1

+6
source

Source: https://habr.com/ru/post/1777018/


All Articles