Structure within union and bit field
- by java
#include <stdio.h>
union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l;
} st;
int i;
} u;
int main()
{
u.i = 100;
printf("%d, %d, %d", u.i, u.st.i, u.st.l);
}
I'm trying to figure out the output of program. The first outputs u.i = 100 but I can't understand the output for u.st.i and u.st.l. Please also explain bit fields.