I've tried on two different machines, and I get zeroes. Is it just a chance and it's garbage ?
#include <stdio.h>
int main()
{
typedef union { int x; } union1;
union1 u;
printf("%d\n", u.x);
}
I'm aware of the compile warning that u isn't initialized, so, please don't include answers or comment about that. I want to know which of the following is the case:
- It's compiler-dependent (If so, please include any official source for gcc)
- It's always garbage and I was just lucky enough to find all zeroes on two different machines.
- It's always zero (If so, please include any official source)