txcotrader
txcotrader

Reputation: 595

Pointer to structure

I'm new to ANSI-C and I'm trying to figure out how this works:

bd_t *bd = gd->bd;

Is this telling me that bd_t = value of a structure value bd?

Upvotes: 0

Views: 125

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 754860

Somewhere, there is a typedef:

typedef something bd_t;

The line:

bd_t *bd = gd->bd;

declares a variable called bd as a pointer to a bd_t, and initializes it with the value of gd->bd from the pointer to structure variable gd. That structure contains a member bd that is presumably also a bd_t *.

From the single line, you can't tell anything more about the type bd_t.

Upvotes: 3

Related Questions