文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>识别复杂变量的声明

识别复杂变量的声明

时间:2010-03-29  来源:liuyuanyang

/* 1. */ void * (*(*fp1)(int)) [10];

/* 2. */ float (*(*fp2)(int, int, float)) (int);

/* 3. */ typedef double (*(*(*fp3)())[10]) ();

fp3 a;

/* 4. */ int (*(*f4())[10]) ();

Number 1 says “fp1 is a pointer to a function that takes an integer argumnet and returns a pointer to an array of 10 void pointers.”

Number 2 says “fp1 is a pointer to a function that takes three arguments(int, int, and float) and returns a pointer to a function that takes an integer argument and returns a flaot.”

Number 3 says “an fp3 is a pointer to a function that takes no arguments and returns a pointer to an array of 10 pointers to functions thant take no arguments and return doubles.”

Number 4 says “f4 is a function that returns a pointer to an array of 10 pointers to functions that returns integers.”

第4个声明的是一个函数,这个函数没有参数,返回一个指针p1

int (*(*f4())[10]) ();

int (*(*p1)[10]) ();

int (* p2 [10]) ();

p1 指向指针数组,大小为10, 每个元素指向一个没有参数,返回值为int的函数.

排行榜 更多 +
jojo的奇妙冒险手机版下载

jojo的奇妙冒险手机版下载

飞行射击 下载
雪糕工厂 v9.87.13.02 安卓版

雪糕工厂 v9.87.13.02 安卓版

休闲益智 下载
雪糕工厂 v9.87.13.02 安卓版

雪糕工厂 v9.87.13.02 安卓版

休闲益智 下载