Share this page

# Example: union

In the following example, a union, mixed,contains just one of either the character, radian, or number fields. Two instances of the union, a and b, are then used in the function Actions.

        union mixed {
            char character;
            float radian;
            int number;
        }

        union mixed a, b;
        a.number = 7;
        b.character = 'e';
        lr_output_message ("number value is %d", a.number);
        lr_output_message ("character value is %c", b.character);

    Example: Output:
    Action.c(14): number value is 7
    Action.c(15): character value is e

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: