1
int *a[5];

Is this an array of 5 pointers or a pointer pointing to an array of size 5?

1
  • 2
    That's array of pointers. Pointer to array int (*a)[5]; Commented Aug 19, 2012 at 6:20

3 Answers 3

5

For future reference, use cdecl.org.

Entering int *a[5], the output is...

declare a as array 5 of pointer to int

Thus, a is an array of 5 int *. :-)

Sign up to request clarification or add additional context in comments.

1 Comment

"C gibberish ↔ English" - Love it! +1
3

It's an array of 5 pointers to int.

You might find the right-left rule helpful.

Comments

0

that's an array of pointers. that's because int * is a type, unlike the impression most people get that the type is int and the name is *a .

Comments

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.