c - How to know which variable value is set for union? -


I am working on optimizing a project. There is an alternative framework in which the user can choose one option at a time. In addition to the option, we can also use a flag variable which option value is set for this record. To make it memory efficient, I want to change the structure in a union. But how do I know that the variable value is set in Union because there is no restriction on bringing the value of one variable in the union, which is not set.

  struct options {int basicPay; Int lmosm pe; Int Mothali Pe; Int weekly payments; Int Daily Pay; Intal Pai; Int petip; // Which option is selected to check the flag variable}; Union optimization optimization {int basicPay; Int lmosm pe; Int Mothali Pe; Int weekly payments; Int Daily Pay; Intal Pai; Int petip; // confused here); << Code>   

You entered union inside struct ? Let's look at the following example equivalents:

  union option {int basicPay; Int lmosm pe; Int Mothali Pe; Int weekly payments; Int Daily Pay; Intal Pai; }; Structure record {union option * op; // Option Union Pay Per Type;   

Union ( option ) will reserve memory for its largest variable and you can set its value and its structure. (Records) will keep track of that union memory block and pay type flag value can be set which will tell your program to bring the union's VATIC variable.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -