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: First addre...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 26102 of 26972
Post > Topic >>

Re: First address of a bidimensional array

by =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= <toe@[EMAIL PROTECTED] > May 7, 2008 at 07:24 AM

On May 7, 3:12=A0pm, nembo kid <u...@[EMAIL PROTECTED]
> wrote:
> I have the following bidimensional array
>
> int a [100][100];


You're right that this is a bi-dimensional array, however the C
language sees it and treats it as an array of arrays. It's the same as
doing the following:

    typedef int HundredInts[100];

    HundredInts a[100];


> Why the first address of this array is only:
>
> & (mat[0][0])
>
> and not also:
>
> mat


You have an array consisting of 100 elements, each of which is a
"HundredInts". The first element of this array is a HundredInt. You
get the first element by doing the following:

    a[0];

The type of a[0] is HundredInts, so a pointer to the first element is
going to be a "HundredInt *", or "int (*)[100]".

Basically it all boils down to the fact that a multi-dimensional
arrays is implemented as an array of arrays.
 




 5 Posts in Topic:
First address of a bidimensional array
nembo kid <user@[EMAIL  2008-05-07 16:12:06 
Re: First address of a bidimensional array
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-07 07:24:22 
Re: First address of a bidimensional array
S S <sarvesh.singh@[EM  2008-05-07 09:36:21 
Re: First address of a bidimensional array
"Default User"   2008-05-07 17:04:42 
Re: First address of a bidimensional array
Chris Torek <nospam@[E  2008-05-07 21:48:51 

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:26:21 CDT 2008.