enum type
{
CHAR,
UCHAR,
INT,
UINT
};
int man()
{
unsigned int data = 0;//data的型別可以隨意指定
InFunction(INT,&data);//輸入型別,轉化爲自己想要的型別
OutFunction(UINT,(void *)&data);//根據自己想要的型別輸出
printf("%u\n",data);
}
void OutFunction(enum type,void* data)
{
int start = 0;
switch(type)
{
case UINT:
unsigned int temp = (unsigned int)start;
*(unsigned int*)data = temp;
break;
default:
break;
}
}
void InFunction(enum type,void* data)
{
unsigned int signal = 0;
swich(type)
case INT:
int* temp = (int*)data;
signal = (unsigned int)(*temp);
break;
default:
break;
}