Talk About Network

Google





Programming > C - C++ Learning > Re: [C] Pointer...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 24 Topic 4140 of 4400
Post > Topic >>

Re: [C] Pointer to an array

by Richard Heathfield <rjh@[EMAIL PROTECTED] > May 21, 2008 at 06:14 AM

Anand Hariharan said:

> On Wed, 14 May 2008 18:32:05 +0000, Richard Heathfield wrote:

<snip>

>> usr_data is converted to &usr_data[0]
> 
> Is that true?

Yes.

> I thought usr_data[0] implies a dereference,

You don't actually need to access the value of usr_data[0] (which is what 
"dereference" means) just to establish its address, which is what & does. 
(Indeed, without knowing its address, it's hard to see how you *could* 
evaluate it.)

> hence
> &usr_data[0] is better expressed as &(*(usr_data)) rather than usr_data.

I don't see why that's better. Surely a simple expression is better than a

complicated expression? We write n, not (n + 8) - 8. We write n, not (n * 
10) / 10. We write sqrt(n), not n/sqrt(n). For the more complicated 
expression to be worth writing, it has to achieve something useful. What 
does &(*(usr_data)) tell us that usr_data doesn't?

-- 
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www.
+rjh@[EMAIL PROTECTED]
 users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
 




 24 Posts in Topic:
[C] Pointer to an array
Aggro <spammerdream@[E  2008-05-14 15:14:02 
Re: [C] Pointer to an array
Richard Heathfield <rj  2008-05-14 16:30:48 
Re: [C] Pointer to an array
Ben Bacarisse <ben.use  2008-05-14 17:44:04 
Re: [C] Pointer to an array
Aggro <spammerdream@[E  2008-05-14 18:15:40 
Re: [C] Pointer to an array
Richard Heathfield <rj  2008-05-14 18:32:05 
Re: [C] Pointer to an array
Aggro <spammerdream@[E  2008-05-14 18:36:49 
Re: [C] Pointer to an array
Richard Heathfield <rj  2008-05-14 18:55:56 
Re: [C] Pointer to an array
Keith Thompson <kst-u@  2008-05-14 13:10:50 
Re: [C] Pointer to an array
Andrey Tarasevich <and  2008-05-14 11:41:42 
Re: [C] Pointer to an array
Anand Hariharan <znvyg  2008-05-21 04:44:12 
Re: [C] Pointer to an array
"Alf P. Steinbach&qu  2008-05-21 06:38:33 
Re: [C] Pointer to an array
Richard Heathfield <rj  2008-05-21 06:14:08 
Re: [C] Pointer to an array
Barry Schwarz <schwarz  2008-05-25 10:44:26 
Re: Pointer to an array
Anand Hariharan <mailt  2008-05-21 07:50:59 
Re: Pointer to an array
"Alf P. Steinbach&qu  2008-05-21 17:11:16 
Re: Pointer to an array
Bart van Ingen Schenau &l  2008-05-21 19:39:27 
Re: Pointer to an array
Andrey Tarasevich <and  2008-05-21 11:50:21 
Re: Pointer to an array
Anand Hariharan <mailt  2008-05-22 13:51:12 
Re: [C] Pointer to an array
Ben Bacarisse <ben.use  2008-05-26 16:57:06 
Re: [C] Pointer to an array
Francis Glassborow <fr  2008-05-26 19:39:07 
Re: [C] Pointer to an array
Keith Thompson <kst-u@  2008-05-26 14:14:19 
Re: [C] Pointer to an array
Ben Bacarisse <ben.use  2008-05-27 04:01:45 
Re: [C] Pointer to an array
Ben Bacarisse <ben.use  2008-05-27 04:23:15 
Re: [C] Pointer to an array
Andrey Tarasevich <and  2008-05-14 11:32:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
localhost-V2008-12-19 Fri Jan 9 5:42:14 PST 2009.