/**/ /*printf 函数类型int printf(const char *, ...);char* gets(char*) int puts(const char *); 类型转换主要一点就是先使指针指向函数。获取函数的入口地址。然后,把指针进行类型转换,转换成printf的类型。即是一个函数指针。*/ #include < stdio.h > #include < conio.h > int main() ... { void *f = (void *)printf; (*(int (*)(const char *, ...))f)("hello world"); void *p; p = (void *) printf; (*(int (*)(const char *, ...))p)(" ok! Hello World "); char hello[22]; void *pf = (void *)scanf; (*(int (*)(const char *,...))pf)("%s",hello); (*(int(*)(const char*, ...))f)("printf is :%s ",hello); char s[33]; void *fp = (void *)gets; (*(char* (*)(char*))fp)(s); printf("s = %s ",s); void *ptr1 = (void *)puts; (*(int (*)(const char*))ptr1)(s); return 0;}