Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
2.14/5 (3 votes)
See more:
What is difference between int (*p)[3] and int *p[3]?
Posted
Comments
Sergey Alexandrovich Kryukov 6-Aug-14 13:55pm    
Questions on "difference" are usually incorrect, and this question is also not so productive. Okay, you will get the answer, but what are you going to do if you face the types with more brackets and '*' characters? There can be huge number of such declarations. Will you need to ask a question each time you face them, while you actually need to be able to write them all when needed? I hope you are going to lean the principles behind those C++ types; it's a but cryptic, to be sure.
—SA

1 solution

C++
int (*p)[3]
is a pointer to an array of integers.
C++
int *p[3]
is an array of int pointers.

Check this post.It has a nice explanation with example code :-)
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 6-Aug-14 13:56pm    
Answered; a 5.
—SA
Dilan Shaminda 6-Aug-14 14:09pm    
Thank you sir :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900