Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site riccb.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!ihopa!riccb!rjnoe From: rjnoe@riccb.UUCP (Roger J. Noe) Newsgroups: net.lang.c Subject: sizeof extern arrays Message-ID: <650@riccb.UUCP> Date: Fri, 21-Mar-86 18:08:20 EST Article-I.D.: riccb.650 Posted: Fri Mar 21 18:08:20 1986 Date-Received: Sat, 22-Mar-86 22:12:31 EST Distribution: net Organization: Rockwell International - Downers Grove, IL Lines: 16 I'm not sure if this is a cc bug or not. Suppose in a file I have the definition of a global array, e.g. int foo[43]; Suppose in another file I have a declaration of foo without the dimension and then refer to the size of the array: extern int foo[]; /* . . . */ sizeof foo / sizeof (int) /* . . . */ Then cc apparently "returns" zero for sizeof foo. Should this happen for an extern array? I know that if I stick in a dimension in the array declaration in the latter file: extern int foo[22]; then the compiler uses that value as the number of elements in the array rather than the number it was defined as having. We're running UNIX System V Release 2 on a VAX-11/785. -- Roger Noe ihnp4!riccb!rjnoe