Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!aplcen!uunet!sco!seanf From: seanf@sco.COM (Sean Fagan) Newsgroups: comp.lang.c Subject: Re: Difference between "char *arr" and "char arr[]" Message-ID: <7920@scolex.sco.COM> Date: 26 Sep 90 21:05:12 GMT References: <8103@aggie.ucdavis.edu> <26680@mimsy.umd.edu> Sender: news@sco.COM Reply-To: seanf (Sean Fagan) Organization: The Santa Cruz Operation, Inc. Lines: 33 In article enag@ifi.uio.no (Erik Naggum) writes: >Rather, "char arr[14]" declares an array, but "extern char arr[]" only >declares that "arr" is some constant pointer the value of which is to >be resolved by the linker. *NO NO NO NO*! 'extern char arr[]' does *not* declare, in any way, shape, or form, a pointer. What it *does* declare is the label of a block of memory (size currently unknown), which will be (hopefully) resolved at link time. The difference between extern char arr[]; and extern char *ptr; is that the first one is not indirected to get the address; the other one is. That is, ptr is actually a double-indirect variable: one indirection to get its value, and another one to dereference it. arr, on the other hand, is just indirected once, to get it's value (which is arr[0]). -- -----------------+ Sean Eric Fagan | "Never knock on Death's door: ring the bell and seanf@sco.COM | run away! Death really hates that!" uunet!sco!seanf | -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor") (408) 458-1422 | Any opinions expressed are my own, not my employers'.