hello Vic,thank you for your comments 

now i understand that the last element of an array could not be always used but 
considering our friend's (brian's) problem could we create an array of integer 
of size 3 i.e. uchar y[2]; then i hope it will work on all the systems. could 
you all give ur comments on that

with regards
Anup
 >
 > unions.c:
 > ============ ========= ========= ========= =
 >
 > #include <stdio.h>
 >
 > union vals {
 >     unsigned short x;
 >     unsigned char y[1];
 > } myvals;
 >
 > int main() {
 >     myvals.y[0] = 1;  //lsb  -- 00000001
 >     myvals.y[1] = 21; //msb --00010101
 >   

 unsigned char y[1] only has a valid subscript of 0
 whether your solution works will depend on whether you're on a big or 
 little endian system

 >     printf("%d", myvals.x); // displaying 16 bit uint 0001010100000001
 >     printf("\n %d", sizeof(myvals) );
 > }
 >
 > ============ ========= ========= ========= ===
 > and its output is :
 >
 > 5377
 >  2
 >

       
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center.

[Non-text portions of this message have been removed]

Reply via email to