多谢两位。<br /><br />帮我看看有没有内存方面及其他的问题啊!我就怕这个<br /><br />typedef struct t_hand<br />{<br /> void (*InterruptHandlers)(void *data);<br /> void **dat;<br />}T_HANDLER;<br />T_HANDLER *hdl[10]; <br /><br />void counter(void *data){<br /> <br /> printf("%s
",(char*)data);<br />}<br />void install(int i,void (*handler)(void *data), void **data){<br /> T_HANDLER *test = (struct t_hand*)malloc(sizeof(struct t_hand));<br /> test->InterruptHandlers = handler;<br /> test->dat = data;<br /> hdl = test;<br />}<br /><br />int main(int argc, char* argv[])<br />{<br /> char *p = (char *)malloc(10);<br /> p = "111";<br /> void **p1 = (void **)&p;<br /> install(1,counter,p1);<br /> p = "2222";<br /> printf("install ok
");<br /> hdl[1]->InterruptHandlers(*(hdl[1]->dat));<br /> return 0;<br />}<br />
|