#include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <time.h> #include <unistd.h> void test(char *msg) ; void testInt(int n); char *resMsg(char *msg); int main() { char *s = "hello "; int n = 222; void* (*func)(void*); func = resMsg; char *t = func(s); printf("t:%s ",t); func = testInt; func(n); func = test; func(s); return 0; } char *resMsg(char *msg) { char *name = "guanxianseng"; char *buff = malloc(strlen(msg) + strlen(name)); memset(buff, 0, sizeof(buff)); sprintf(buff, "%s%s", msg, name); return buff; } void testInt(int n) { printf("n:%d ", n); } void test(char *msg) { printf("msg:%s ", msg); }