Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Allowed types in C

Posted on 2006-05-27
3
Medium Priority
?
200 Views
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?
0
Comment
Question by:UrosVidojevic
  • 2
3 Comments
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 16776798
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
 
LVL 7

Author Comment

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

Accepted Solution

by:
brettmjohnson earned 400 total points
ID: 16780437
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

810 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