Calling union member in struct with c -


below piece of code working on..

struct argusrecord {    struct argusrecordheader hdr;    union {       struct argusmarstruct     mar;       struct argusmarsupstruct  sup;       struct argusfarstruct     far;       struct arguseventstruct event; #if defined argus_pluribus       struct argusvflowstruct vflow; #endif    } ar_un; }; 

i have defined variable as

struct argusrecord myrecord; 

i can call first member myrecord.hdr if same way call union members such mar, sup .. etc getting error message ..... has no member named ‘mar’

please 1 tell me how call union members.

you have call using union name ar_un

myrecord.ar_un.mar 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -