Difference between *p[5] and (*p)[5]?

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Apr 2009
Posts: 32
Reputation: thebluestar is an unknown quantity at this point 
Solved Threads: 0
thebluestar thebluestar is online now Online
Light Poster

Difference between *p[5] and (*p)[5]?

 
0
  #1
Nov 6th, 2009
I'm not sure about the difference between *p[5] and (*p)[5]?
Please help me clarify them?
Thanks a lot!
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 32
Reputation: thebluestar is an unknown quantity at this point 
Solved Threads: 0
thebluestar thebluestar is online now Online
Light Poster
 
0
  #2
Nov 6th, 2009
It turns out that this can be done and that
int (*p1d)[5];

is the proper declaration, i.e. p1d here is a pointer to an array of 5 integers just as it was
under the declaration using the Array type. Note that this is different from

int *p1d[5];

which would make p1d the name of an array of 5 pointers to type int.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 67
Reputation: Iam3R is an unknown quantity at this point 
Solved Threads: 3
Iam3R Iam3R is offline Offline
Junior Poster in Training
 
0
  #3
Nov 6th, 2009
which would make p1d the name of an array of 5 pointers to type int.
this one

  1. int *p1d[5];
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 275 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC