0

When we have :

struct node {
    char...
    int....
    struct node *....
}

typedef struct node Node;

and then we have a function like this:

int function(Node f){...}

What is this f ?

4
  • f is a variable of type Node, which is essentially same as the type struct node. Commented Jun 6, 2018 at 11:56
  • is this like f is a struct node variable? Commented Jun 6, 2018 at 11:59
  • Yes, it is..... Commented Jun 6, 2018 at 12:01
  • More struct related terminology can be found here. Commented Jun 6, 2018 at 12:24

2 Answers 2

2

f is an input argument of the type Node. The type Node is synonym of the type struct node.

Sign up to request clarification or add additional context in comments.

1 Comment

alias is probably a better choice over synonym for describing what Node is.
1

In the statement typedef struct node Node; you are giving alias name of struct node as Node by using typedef.

So in the definition of function()

int function(Node f){...}

f is nothing but variable of struct node type.

Also you can see the typedef declaration and meanings here http://en.cppreference.com/w/c/language/typedef

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.