Figuring out C Declarations like: double (*b)[n]

前端 未结 4 1547
执笔经年
执笔经年 2020-12-31 04:48

I\'m trying to figure out some C declarations. What is the meaning of these C declarations?

double (*b)[n];
double (*c[n])();
double (*d())[n];
4条回答
  •  清酒与你
    2020-12-31 05:24

    There are two great resources to understand "C gibberish":

    • http://cdecl.org/ - Online service that translates "C gibberish ↔ English"
    • The "Clockwise/Spiral Rule" by David Anderson if you want to understand what better what is going on

    Output of cdecl.org:

    • double (*c[n])(): Syntax error (n is not valid here)
    • double (*c[])(): declare c as array of pointer to function returning double

提交回复
热议问题