delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/25/08:18:55

Date: Tue, 25 Nov 1997 08:18:22 -0500 (EST)
Message-Id: <199711251318.IAA01497@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: blizzar AT hem1 DOT passagen DOT se
CC: swarnerx3 AT acadia DOT net, djgpp AT delorie DOT com
In-reply-to: <3.0.16.19971125104154.290fe38a@hem1.passagen.se> (message from
Peter Palotas on Tue, 25 Nov 1997 10:42:18 -0500)
Subject: Re: pointers &arrays[]

> >array == &array
> This is NOT true. `&array' is a pointer to array, i.e. a pointer to the
> pointer of the first element in the array.

No, it is true.  Even if they weren't the same, "&array" would be the
right one, since it's a pointer, and "array" isn't a pointer - it's
the whole array, like "int" is all 32-bits of an integer.

Besides, you can try it yourself:

#include <stdio.h>

int foo[10];

main()
{
  printf("foo=%p &foo=%p\n", foo, &foo);
  return 0;
}

$ ./array
foo=10000090 &foo=10000090

- Raw text -


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