delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/11/21/19:06:29

From: swarnerx3 AT acadia DOT net (Scott Warner)
Subject: pointers &arrays[]
21 Nov 1997 19:06:29 -0800 :
Message-ID: <199711210929.EAA01841.cygnus.gnu-win32@p2.acadia.net>
Mime-Version: 1.0
To: <gnu-win32 AT cygnus DOT com>

In a recent chat room discussion, pointer notation of arrays in C was
brought up.  The question is, are array names pointers?  Is array
subscripting another form of pointer notation, or visa-versa?  I realize
the pointer notation works for everything except sizeof() (and maybe
others).  So that

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?

-
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".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019