函数指针与指针函数

int* test(int a, char b)
{
	printf("%d\n", a);
}

void test1(int a)
{
	printf("%d\n", a * a);
}

void test2(int a)
{
	printf("%d\n", a * 5);
}

int main()
{

	int *(*p)(int, char) = test;
	p(10, '1');
	return 0;
}
/*
指针函数:函数的返回值是指针
函数指针:用来存储函数地址的变量表,可以通过函数指针显示对函数的调用,
          进而可以实现函数重载(可以通过给函数指针赋不同的函数值来注册不同的函数实现)
*/

posted @ 2023-09-17 22:56  邹木木  阅读(12)  评论(0编辑  收藏  举报