#include <stdio.h>
#include <stdlib.h>
#define MASK 0xffL
/* 带上'L'相当于声明了一个长整型数值 */
void main()
{
unsigned long IP_address;
unsigned int HighByte,SecondByte,ThirdByte,LastByte;
printf("Please enter hex IP address:");
scanf("%lx",&IP_address);
HighByte
= (IP_address >> 24) & MASK;
SecondByte = (IP_address >> 16) & MASK;
ThirdByte
= (IP_address >> 8 ) & MASK;
LastByte
= IP_address
& MASK;
printf("Your entered 0x%x\n",IP_address);
printf("The IP address is: %d.%d.%d.%d\n",HighByte,SecondByte,ThirdByte,LastByte);
}