This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to access initialized values of global variables


Hello,

I am trying to fetch the initialized values of global variables.
For eg : int i = 10;

I am able to extract the value using DECL_INITIAL.
But when I have a case like below,

struct node
{
        int x;
        int y;
};

struct node n1=
{
        99,
        88,
};

I get value as {.x=99, .y=88}

How should I iterate to fetch 99 and 88 individually?
In a way I want to access individual variables initialized values.
Can someone tell me the way to do it.

Thanks in advance.

Regards,
Swati



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]