If we have a union with three variables int i, char c, float f; and we store a value in say the variable c now. and we forget what is the variable of the union that holds a value currently, after some time. for this is there any mechanism provided by the language using which we can find out whether it is i or c or f that currently holds a value.
Share
It is not possible. The different members of a union all refer to the same memory adress, they are just different ways of seeing that memory. Modifiying a member of the union modifies all the other. You cannot distinguish one from another.