I want to know that supply void type in keil c51 REV 7.XX following is program #include <reg52.h> #include <stdio.h> #define NUMBER 2 typedef struct Test { void (*FuncP)(void *); void *Farg; } Test; int max(int a[NUMBER]) { int z; if (a[0]>a[1]) z=a[0]; else z=a[1]; return(z); } main() { int a[NUMBER]={1,2}; void i; Test *TmrTest; TmrTest->FuncP=(void *)max; TmrTest->Farg=(void *)&a[0]; i=(*TmrTest->FuncP)(TmrTest->Farg); } error infomation: error c136: 'i': 'void' on variable error c186: invalid dereference or #include <reg52.h> #include <stdio.h> #define NUMBER 2 typedef struct Test { void (*FuncP)(void *); void *Farg; } Test; int max(int a[NUMBER]) { int z; if (a[0]>a[1]) z=a[0]; else z=a[1]; return(z); } main() { int a[NUMBER]={1,2}; int i; Test *TmrTest; TmrTest->FuncP=(void *)max; TmrTest->Farg=(void *)&a[0]; i=(int *)(*TmrTest->FuncP)(TmrTest->Farg); } error infomation: error c215:illegal type conversion ,follow is OK, functin max isn't ..... #include <reg52.h> #include <stdio.h> #define NUMBER 2 typedef struct Test { void (*FuncP)(void *); void *Farg; } Test; int max(int a[NUMBER]) { int z; if (a[0]>a[1]) z=a[0]; else z=a[1]; return(z); } main() { int a[NUMBER]={1,2}; Test *TmrTest; TmrTest->FuncP=(void *)max; TmrTest->Farg=(void *)&a[0]; (*TmrTest->FuncP)(TmrTest->Farg); }
"[What exactly are you hoping to achieve by posting the same question three times in a row?]" That could well be a fault with the Forum, rather than the poster; Keil Support themselves have been known to repeat the same reply up to about 7 times!!! :-0