How to get field name/array index of a init list expression?

Say I have code below:

char *init[] = {
“string1”, “string2”
}

When I visit expression StringLiteral “string1”, I need something like “init[0]”.

struct _thestruct {
char str[20];
int foo;
};

_thestruct var[] = { {“string1”, 2}, {“string2”, 3} };

When I visit expression StringLiteral “string2”, I need “var[1].str”.

How do I implement this?

Thanks.