Q1.
Is the above declaration "union uv xv[3];" valid??Code:union uv { unsigned long vol; unsigned char vol_bricks[4]; }; xdata union uv xv[3];
Can I declare array of unions as above??
![]()
2)
HERE:Code:void f1() { union uv biggest_value; xv[0].vol = value0; xv[0].vol = value0; xv[0].vol = value0; biggest_value.vol = xv[0].vol; if( biggest_value.vol_bricks[0] < xv[1].vol_bricks[0] ) biggest_value.vol = xv[1].vol; if( biggest_value.vol_bricks[0] < xv[1].vol_bricks[0] ) biggest_value.vol = xv[1].vol; Global_value = biggest_value.vol; }
"if( biggest_value.vol_bricks[0] < xv[1].vol_bricks[0] )"
"if( biggest_value.vol_bricks[0] < xv[1].vol_bricks[0] )"
these "if" statements are observed, they are never true.
Is there any error in declaration?
Is the way "character item 0" in the unoins are compared causing any problem?
3.I require guidance regarding usage of UNION.



LinkBack URL
About LinkBacks



