wjason 发表于 2013-2-4 22:11:36

函数指针与函数引用

<div class="cnt">不小心翻了一下c++程序设计语言一道函数引用的练习题,函数引用有什么价值? 没想出来。记一下,先准备明天的面试吧,hp,加油! :)
 
 
#include <stdio.h>

typedef int(&A)(int);
typedef int(*B)(int);

int test1(int a)
{
   printf("test1 %d\n",a);
   return a;
}
 
int main()
{
   int i;
   A aa = *******test1;
   //A aaa = &test1;//err
   B bb = ********test1;
   B bbb = &test1;

   aa(i);
   bb(i);
}
页: [1]
查看完整版本: 函数指针与函数引用