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
Post a Comment