Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: What is the...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 6 Topic 26056 of 26972
Post > Topic >>

Re: What is the difference between: int a (*daytab)[13] and int a *daytab[13]

by Ben Bacarisse <ben.usenet@[EMAIL PROTECTED] > May 4, 2008 at 09:42 PM

santosh <santosh.k83@[EMAIL PROTECTED]
> 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 Posts in Topic:
What is the difference between: int a (*daytab)[13] and int a
magicman <ironsel2000@  2008-05-04 11:49:22 
Re: What is the difference between: int a (*daytab)[13] and int
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-04 11:59:54 
Re: What is the difference between: int a (*daytab)[13] and i
"Bartc" <bc@  2008-05-04 19:03:49 
Re: What is the difference between: int a (*daytab)[13] and i
santosh <santosh.k83@[  2008-05-05 01:27:45 
Re: What is the difference between: int a (*daytab)[13] and i
Ben Bacarisse <ben.use  2008-05-04 21:42:14 
Re: What is the difference between: int a (*daytab)[13] and i
santosh <santosh.k83@[  2008-05-05 02:16:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:27:50 CDT 2008.