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 5 of 5 Topic 26102 of 26972
Post > Topic >>

Re: First address of a bidimensional array

by Chris Torek <nospam@[EMAIL PROTECTED] > May 7, 2008 at 09:48 PM

In article <4821b7c6$0$35957$4fafbaef@[EMAIL PROTECTED]
>
nembo kid  <user@[EMAIL PROTECTED]
> wrote:
[given]
>int a[100][100];
>Why the first address of this array is only:
>&(mat[0][0])
[vs mat, mat+0, or &mat[0]; but consider also &mat!]

See the diagram at <http://web.torek.net/torek/c/pa.html>:
there
are multiple "first address"-es, differing in type, and hence in
the "size of the circles".

Here is the next point to ponder: Are they all "the same" address?
Maybe they are, maybe they are not.  Is 3.14159265 the same number
as 3?  How about 3.00000 vs 3?  What happens if you printf() the
result of the following four comparisons?

    (int)3.14159265 == 3
    (double)3 == 3.14159265
    (int)3.0 == 3
    (double)3 == 3.0

Based on what you get if you do printf() those, is it perhaps the
case that 3.0 is "more equal to 3" than 3.14159265?

(We can only compare things for equality after we convert them to
some common type, and the conversion itself may -- or may not --
change "something im****tant".  When we convert a double to an int,
we chop off the fractional part.  Is it im****tant?  Maybe, but
maybe not: it all depends on what we *meant* with the original
double.)
-- 
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W)  +1 801 277 2603
email: gmail (figure it out)      http://web.torek.net/torek/index.html
 




 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:29:25 CDT 2008.