简体   繁体   中英

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 ?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM