|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
thx
|
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
int (*)[13] Pointer to an array of 13 int's. int *[13] Array of 13 pointers to int's. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
"magicman" <ironsel2000@gmail.com> wrote in message news:11cc16fd-e18d-423d-a226-e02dbd62d0bc@k13g2000hse.googlegroups.com.. [What is the difference between: int a (*daytab)[13] and int a *daytab[13]] As written: nothing, they're both syntax errors. On the other hand, int (*daytab)[13] is a pointer to an array of 13 ints. While int *daytab[13] is an array of 13 pointers to ints. (Thanks to a program cdecl.exe I've just downloaded. Otherwise I wouldn't have a clue either. And the existence of such a program suggests I'm not alone!) -- Bartc |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
magicman wrote:
> What is the difference between: int a (*daytab)[13] and int a > *daytab[13] > thx In a declaration the first one declares daytab as a pointer to an array of 13 ints. The second declares daytab as an array of 13 int*. For the first one daytab[n] will be of type int and for the second one daytab[n] will be of type int*. PS. For 0 <= n <= 12 of course. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
santosh <santosh.k83@gmail.com> writes:
> magicman wrote: > >> What is the difference between: int a (*daytab)[13] and int a >> *daytab[13] >> thx > > In a declaration the first one declares daytab as a pointer to an array > of 13 ints. The second declares daytab as an array of 13 int*. I guess you are ignoring the "a" in both! > For the first one > > daytab[n] > > will be of type int It will be of type "array of 13 int". It will be converted to an int pointer in most contexts hence, I suspect, the confusion. > and for the second one > > daytab[n] > > will be of type int*. Yes, in both cases daytab[n] could be further subscripted or passed to function that expects and int *. -- Ben. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Ben Bacarisse wrote:
> santosh <santosh.k83@gmail.com> writes: > >> magicman wrote: >> >>> What is the difference between: int a (*daytab)[13] and int a >>> *daytab[13] >>> thx >> >> In a declaration the first one declares daytab as a pointer to an >> array of 13 ints. The second declares daytab as an array of 13 int*. > > I guess you are ignoring the "a" in both! Oops! I'm starting to really believe the research indications that the brain "reads" what it "wants to read", or "completes" sentences from partially reading them. Thanks once again for the correction. >> For the first one >> >> daytab[n] >> >> will be of type int > > It will be of type "array of 13 int". It will be converted to an int > pointer in most contexts hence, I suspect, the confusion. > >> and for the second one >> >> daytab[n] >> >> will be of type int*. > > Yes, in both cases daytab[n] could be further subscripted or passed to > function that expects and int *. > |
|
![]() |
| Outils de la discussion | |
|
|