Afficher un message
Vieux 04/05/2008, 22h46   #6
santosh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: What is the difference between: int a (*daytab)[13] and int a *daytab[13]

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 *.
>


  Réponse avec citation
 
Page generated in 0,05438 seconds with 9 queries