#include <reg52.h>
unsigned char arr1[4]={0x00,0x80,0x01,0x00};
unsigned int char2int(unsigned char * srcarr,unsigned char pos)
{
unsigned int tempvar;
pos<<=1;
((unsigned char *)&tempvar)[0]=srcarr[pos];
pos++;
((unsigned char *)&tempvar)[1]=srcarr[pos];
return(tempvar);
}
void main()
{
unsigned int t1,t2;
while(1)
{
t1=char2int(arr1,0);
t2=char2int(arr1,1);
}
}
|