#include <stdio.h>
void computer(void *arg, int flag)
{
int*p1;
long int *p2;
float *p3;
double *p4;
switch(flag)
{
case 1:
p1 = (int *)arg;
printf ("*p1/2=\n",*p1/2);
break;
case 2:
p2 = (long int *)arg;
printf ("*p2/2=ld\n",*p2/2);
break;
case 3:
p3 = (float *)arg;
printf ("*p3/2=%f\n",*p3/2);
break;
case 4:
p4 = (double *)arg;
printf ("*p4/2=%f\n",*p4/2);
break;
default:
printf("input flag error!\n");
}
return ;
}
main()
{
int a =12;
float b=2.05;
long int c=(1<<15-1);
clrscr();
computer((void *)&a,1);
computer((void *)&b,3);
computer((void *)&c,2);
}