An anonymous union is a union that has neither a tag name nor any objects specified in its declaration.
#include <iostream> using namespace std; main(void) { union { int i; char ch[2]; } ; /* Now reference i and ch without referencing a union name or dot or arrow operators. */ i = 88; cout << i << " " << ch[0]; return 0; }
1. | Use union to define class | ||
2. | Unions and Classes are Related | ||
3. | Anonymous union |