Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I declare an array of pointers to functions returning pointers to functions returning pointers to characters?

0
Posted

How do I declare an array of pointers to functions returning pointers to functions returning pointers to characters?

0

This question can be answered in at least three ways (all declare the hypothetical array with 5 elements): 1. char *(*(*a[5])())(); 2. Build the declaration up in stages, using typedefs: typedef char *pc; /* pointer to char */ typedef pc fpc(); /* function returning pointer to char */ typedef fpc *pfpc; /* pointer to above */ typedef pfpc fpfpc(); /* function returning… */ typedef fpfpc *pfpfpc; /* pointer to… */ pfpfpc a[5]; /* array of… */ 3. Use the cdecl program, which turns English into C and vice versa: cdecl> declare a as array 5 of pointer to function returning pointer to function returning pointer to char char *(*(*a[5])())() cdecl can also explain complicated declarations, help with casts, and indicate which set of parentheses the arguments go in (for complicated function definitions, like the above). Versions of cdecl are in volume 14 of comp.sources.unix (see question 17.8) and K&R II. Any good book on C should explain how to read these complicated C declarations “ins

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123