Sun Voyager
Sun Voyager

Reputation: 157

Struct variable

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 ?

Upvotes: 0

Views: 108

Answers (2)

Achal
Achal

Reputation: 11921

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

Upvotes: 1

rhaport
rhaport

Reputation: 550

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

Upvotes: 2

Related Questions