C How to define a union?

#include <stdio.h>

union SampleUnion {
    int intValue;
    float floatValue;
    char charValue;
};

int main() {
    union SampleUnion myUnion;

    myUnion.intValue = 10;
    printf("Integer value: %d\n", myUnion.intValue);

    myUnion.floatValue = 3.14;
    printf("Float value: %f\n", myUnion.floatValue);

    myUnion.charValue = 'A';
    printf("Char value: %c\n", myUnion.charValue);

    return 0;
}