#include<stdio.h>
void* add(void* lv,void* rv,char op)
{
switch (op)
{
case 'i':*(int*)lv+=*(int*)rv;break;
case 'l':*(long*)lv+=*(long*)rv;break;
case 'f':*(float*)lv+=*(float*)rv;break;
case 'd':*(double*)lv+=*(double*)rv;break;
}
return lv;
}
int main()
{
float a=1,c=2;
float b=*((float*)*add(&a,&c,'f'));
//这里应该怎么改,,???
printf("%f\n",b);
return 0;
}
cpp(16) : error C2100: illegal indirection