33 lines
783 B
C++
33 lines
783 B
C++
#include<conio.h>
|
|
|
|
|
|
|
|
|
|
struct byte_de_long { unsigned char P3; unsigned char P2;
|
|
unsigned char P1; unsigned char P0;
|
|
};
|
|
union lngchr{ long Numero; struct byte_de_long Byte; } Division;
|
|
//////////////////////////////
|
|
// long --> FF FF FF FF --> 3 34 65 59
|
|
// P0 P1 P2 P3 Dec.89 101 52 3
|
|
////////////////////////////// Hex.59 65 34 3
|
|
|
|
void main(void){
|
|
int iP0, iP1, iP2, iP3;
|
|
clrscr();
|
|
cscanf("%ld", &Division.Numero );
|
|
cprintf("\r\n");
|
|
cprintf("LONG --> %ld", Division.Numero);
|
|
cprintf("\r\n");
|
|
cprintf("Bytes de un long:\r\n");
|
|
iP0 = Division.Byte.P0;
|
|
iP1 = Division.Byte.P1;
|
|
iP2 = Division.Byte.P2;
|
|
iP3 = Division.Byte.P3;
|
|
cprintf("P3 --> %d P2 --> %d P1 --> %d P0 --> %d\r\n", iP3, iP2, iP1, iP0);
|
|
cprintf("\r\n");
|
|
|
|
|
|
|
|
|
|
} |