Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to store multiple integer variables with one integer variable in C language?
How to store multiple integer variables with one integer variable in C language?
To provide an idea for reference, * * * isomorphism and bit operation can be realized, but the data cannot be too large in this way. After all, long int has only 4 bytes.

# contains "stdio.h"

void main()

{

Typedef union t{

char n[4];

Long int sum//sum is 4 bytes, occupying the same storage space as n[4]. Changing the value of n also changes the value of sum.

} UT

UT TT;

TT . n[0]= 20 14;

TT . n[ 1]= 9;

TT . n[2]= 4;

TT . n[3]= 1 1;

printf("%ld\n ",TT . sum);

}