Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ucdavis!iris!kuan From: kuan@iris.ucdavis.edu (Frank [Who me?] Kuan) Newsgroups: comp.lang.c Subject: Difference between "char *arr" and "char arr[]" Message-ID: <8103@aggie.ucdavis.edu> Date: 22 Sep 90 03:23:35 GMT Sender: usenet@aggie.ucdavis.edu Reply-To: kuan@iris.ucdavis.edu (Frank [Who me?] Kuan) Organization: U.C. Davis - Department of Electrical Engineering and Computer Science Lines: 24 In file "a.c", I declare: char targ[128]; In file "b.c" I do: extern char *targ; Result: I got massive errors. When I source debugged it, it told me that the char pointer "targ" was 0x000000. By chance, I tried redeclaring it as "extern char targ[]" and the problem was fixed. Now, I always thought that "targ[]" and "char *targ" were equivalent. I have several places in my program where I use those two notations interchangeably, and this was the first time I've ever had a problem with it. Could a C wizard explain to me what I'm doing wrong and what the correct practice is so I don't run into these horrible bugs again? Thanks in advance. - f