Allowed types in C

Posted on 2006-05-27
Last Modified: 2010-04-15
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?
Question by:UrosVidojevic
    LVL 23

    Expert Comment

    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.

    LVL 7

    Author Comment

    Ok, but I still don't understand why it is not allowed data type. Why this is not pointer to array of functions...?
    LVL 23

    Accepted Solution

    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 **));

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
    Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
    The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now