C语言复杂定义

C gibberish ↔ English
练习:

  1. f是一个大小为5的数组,数组的元素类型是指针,指向的是参数为int,返回值为int *的函数
    declare f as array 5 of pointer to function (int) returning pointer to int
int *(*f[5]) (int);
  1. 返回值为int的函数
    declare abc as function returning int
int abc();
  1. 大小为3的int型数组,declare abc as array 3 of int
int abc[3];
  1. declare abc as function returning pointer to pointer to int
int **abc();
  1. declare abc as pointer to function returning int
int (*abc)();
  1. declare abc as pointer to array 6 of int
int (*abc)[6];
  1. declare abc as function returning pointer to int
int *abc();
  1. abc是大小为6的数组,数组每个元素是指针类型,指向入参为空,返回值为int**的函数,declare abc as array 6 of pointer to function returning pointer to pointer to int
int **(*abc[6])();
  1. abc是大小为6的数组,每个元素是指向int型的指针的指针。declare abc as array 6 of pointer to pointer to int
int **abc[6];
  1. abc是指针,指向大小为6的数组,数组的每个元素的类型是int *。declare abc as pointer to array 6 of pointer to int
int *(*abc)[6];
  1. declare f as pointer to pointer to function returning int
int (** f) ();
  1. declare abc as function returning pointer to function returning pointer to int
//声明abc是一个入参为空的函数
int *(*abc())();
//对上式去掉函数名和参数后
//如下行所示便是函数abc的返回值类型,是一个函数指针,它指向的函数的入参为空,返回值为int *
int *(*)();
  1. abc是个指针,指向一个函数,该函数入参为空,返回值为二级指针,指针指向一个入参为空,返回值为int的函数
    declare abc as pointer to function returning pointer to pointer to function returning int
int (**(*abc)()) ();
// int (**) ();
  1. abc是个指针,指向一个函数,函数的入参为空,返回值为指针,指向大小为6的数组,数组的元素类型是int
    declare abc as pointer to function returning pointer to array 6 of int
int (*(*abc)())[6];
//int (*)[6];
  1. abc是指针,指向一个函数,函数的入参为空,返回值为一个指针,指向一个数组,数组大小是6,数组的元素类型是指针,指向的是一个函数,函数的入参为空,返回值为int *
    declare abc as pointer to function returning pointer to array 6 of pointer to function returning pointer to int
int *(*(*(*abc)())[6]) ();
//int *(*(*)[6]) ();
//int *(*) ();
  1. f 是一个大小为3的数组,数组元素的类型是指针,指向一个函数,函数入参为空,返回值为char
    declare f as array 3 of pointer to function returning char
char (* f[3]) ();
//char (*) ();
  1. foo是个指针,指向一个函数,函数的入参为void,返回值是个指针,指向大小为3的数组,数组的元素是int类型
    declare foo as pointer to function (void) returning pointer to array 3 of int
int (*(*foo)(void ))[3]
//int (*)[3]
  1. f是个函数声明,函数的入参是空,返回值是个大小为7的数组,数组的每个元素是指针,指向一个函数,函数的入参为空,返回值为int *
    declare f as function returning array 7 of pointer to function returning pointer to int
int *(*f()[7])();
//int *(* [7])();
//int *(*)();
  1. declare bar as const pointer to array 5 of pointer to function (int) returning const pointer to char
char * const (*(* const bar)[5])(int )
  1. x是个大小为3的数组,数组的类型是指针,指向一个函数,函数入参为空,返回值是指针,指向大小为5的char型数组
    declare x as array 3 of pointer to function returning pointer to array 5 of char
char (*(*x[3])())[5]
//char (*(*)())[5]
//char (* )[5]
  1. declare foo as pointer to function (pointer to const void) returning pointer to array 3 of int
int (*(*foo)(const void *))[3]
  1. declare d as pointer to function (pointer to int, pointer to function (pointer to char, pointer to pointer to char) returning pointer to pointer to char) returning pointer to pointer to void
// d是指针,指向一个函数,
//          第一个参数是int *
//          第二个参数是一个指针,指向一个函数,
//                                第一个参数是char *, 
//                                第二个参数是char **,
//                                返回值类型是char **
//          返回值类型是void**
void **(*d)(int *, char **(*)(char *, char **));
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值