2

I will like to declare a typedef, something like this:

  • Pointer to any array of another typedef.

for e.g.:

Typedef 1:

typedef struct
{
    int a;
}structA_t1;

Typedef 2:

typedef ptrstructA  structA_t1 (*Temp)[]  ;

Is this second typedef correct ? Do i really need this Temp name here ? Please suggest, thanks

2
  • Wouldn't it be typedef structA_t1 (*ptrstruct)[]; or somethin Commented Jul 27, 2011 at 17:56
  • Why do you want to make a typedef like that? It's commonly considered poor form to create typedefs that hide that fact that something's a pointer. Commented Jul 27, 2011 at 18:19

1 Answer 1

7

The name of the newly defined type comes in the end:

typedef structA_t1 **ptrstructA;

or:

typedef structA_t1 (*ptrstructA)[];
Sign up to request clarification or add additional context in comments.

1 Comment

More specifically, it replaces the variable name that would be there if it weren't a typedef.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.