httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David D'Antonio" <...@newsedge.com>
Subject Re: [Fwd: Problem 2534]
Date Mon, 03 Aug 1998 23:42:07 GMT

-----Original Message-----
From: Alexei Kosut <akosut@leland.Stanford.EDU>
To: new-httpd@apache.org <new-httpd@apache.org>
Date: Monday, August 03, 1998 7:31 PM
Subject: Re: [Fwd: Problem 2534]


>On Mon, 3 Aug 1998, David D'Antonio wrote:
>
>> Its been a while and things might have changed, but I always thought that
>> (single dimensional) arrays and pointers *are* the same thing in C, which
>> is why they act the same. the square brackets are an operator which does
>> pointer math and de-references the result.
>
>Yes. In some cases, arrays and pointers are the treated very much the
>same. For example, the [] operator means much the same thing for both; 
>a[b] == *(a + b), regardless of what a and b are. However, the [] operator
>is not the only thing one does with arrays and pointers.
>
>Arrays and pointers are laid out differently in memory, on the stack or in
>the global data area. Pointers are a couple of bytes (four or eight) that
>point to an address somewhere else. Arrays allocate enough space directly
>for each of the elements. This has an important meaning when you refer to
>the variables by name. For example: 


[rest of explanation snipped]

Ok, I get it. For the uses that I have made of them, they *are* the same. But
I see they are also different when you initialize them the way you are doing.

>-- Alexei Kosut <akosut@stanford.edu> <http://www.stanford.edu/~akosut/>
>   Stanford University, Class of 2001 * Apache <http://www.apache.org> *


Thanks for the info,
DDA



Mime
View raw message