From: jazz AT softway DOT com (Jason Zions) Subject: Re: pointers &arrays[] 24 Nov 1997 05:45:34 -0800 Message-ID: <34790D3B.545CEA8C.cygnus.gnu-win32@softway.com> References: <199711210929 DOT EAA01841 AT p2 DOT acadia DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Scott Warner Cc: gnu-win32 AT cygnus DOT com > array == &array[0] > array == &array > *array == array[0] > *(array+n) == array[n] > > are all true given array[n]. In this case, sizeof(array) returns the size > of the entire array, not array[0]. Are there other examples where this > pointer notation fails? > Lastly, is this pointer notation implementation dependent or is it part of > the de facto standard? I don't know about de facto standards for C; nowadays, there pretty much aren't any, since there is a de jure standard, ISO C (IS 9981 if memory serves). And the pointer/array equivalences you mentioned are required by the standard. The compiler can only make sizeof(array) equal to the size of the array when in fact the compiler can see a complete definition of the array in-scope. If you pass array as a parameter to a function, a sizeof() expression in that function generally won't know how big the array actually is. Arrays are not first-class datatypes in C; most of the time an array of type Foo has to be treated as a pointer to an element of type Foo. Jason - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".