structure - In C, is it possible access a variable name at run time via pointer -
in c, want access variable name @ run time. instance there structure abc
struct alpha { int aaa1, int aaa2, char bbb1 }; struct alpha alp; char *ptr_alpha =&alp;
is possible can use expression like
if (alpha element1 name == "aaa1") { this; } else { that; }
it doesn't make sense access variable name in runtime. every beginner gets idea @ point, originates lack of understanding of goes on "underneath hood". identifiers such variable names, function names, types etc exist in source code. there programmer. in compiled binary, there isn't trace left of identifiers.
there various language mechanisms should used try achieve: enums, pointers, function pointers , on. specific case, there little information trying achieve, give suggestion how solve it.
Comments
Post a Comment