My expected output for u6.c was ABC but here I got CBA why is it so? Could you please shed some light on this with detailed explanation?
union mediatech
{
int i;
char c[5];
};
int main(){
mediatech u1 = {2}; // 1
mediatech u2 = {'a'}; // 2
mediatech u3 = {2.0}; // 3
mediatech u6 = {'ABC'}; // 6
cout<<"\nu6.i = "<<u6.i<<" u6.c="<<u6.c; // o/p: u6.i=4276803 u6.c=CBA
}