• C

Allowed types in C

Hi, this is one "usual" data type, which every programmer (including the beginers) use at least 10 times a day, 10 times within each program (including "Hello World" programs).

(I'm just kidding, I saw it on some test). The question on the test was: "Is this an allowed data type?".

char *((*f)[](char **));

It looks like it is correct:
"pointer to an array of functions which have pointer to pointer to char as argument and return a pointer to char".

On the other side, Dev C++ compiled this, but Turbo C 2.01 is reporting error (NOT ALLOWED DATA TYPE).

So,.. is this allowed data type?
LVL 7
UrosVidojevicAsked:
Who is Participating?
 
brettmjohnsonConnect With a Mentor Commented:
char *((*f[])(char **));

f is an array of pointers to functions.
If you want a pointer to and array of pointers to functions, it would be:

char *((**f)(char **));
0
 
brettmjohnsonCommented:
You have a misplaced parenthesis.  The square brackets should move inside the parens:

char *((*f[])(char **));

Now this still isn't quite right, since the array has no [implicit or explicit] size,
but it gets you passed the syntax error.


0
 
UrosVidojevicAuthor Commented:
Ok, but I still don't understand why it is not allowed data type. Why this is not pointer to array of functions...?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.