From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: Question: allocation Date: Tue, 22 Jun 1999 14:48:36 -0400 Content-Transfer-Encoding: 7bit References: <7km7cs$sc$1 AT nslave1 DOT tin DOT it> X-Posted-Path-Was: not-for-mail X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-ELN-Date: 22 Jun 1999 18:47:17 GMT X-ELN-Insert-Date: Tue Jun 22 12:45:33 1999 Organization: Nocturnal Aviation Lines: 51 Mime-Version: 1.0 NNTP-Posting-Host: 1cust85.tnt11.nyc3.da.uu.net Message-ID: <376FDA84.548CC50C@earthlink.net> X-Mailer: Mozilla 4.6 [en] (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Marco Fabiani wrote: > > I've a little question: > > i'f i declare: > > int a[10]; > int b[10]; > > int main() > { > int c[10]; > int d[10]; > > /* ecc.ecc. */ > return 0; > } > > where a, b, c, d goes? > c and d should go on stack, that in Intel-based machines means c > d (c is > allocated at an upper address than d), but a and b?? Does djgpp use a data > segment for global variables (thus b > a) or system stack (thus a > b)? > And, is it safe to assume that a and b are allocated consecutively in > memory? As soon as you start thinking in this kind of machine-specific way, you already should hear warning bells go off. Suppose you simply have #define SEMISIZE 10 int a[2*SEMISIZE]; int main(void) { int c[2*SEMISIZE], *b, *d; b = a + SEMISIZE; d = c + SEMISIZE; /* usw. */ return 0; } There is a good chance that this sort of coding will get you where you want to go. -- Martin Ambuhl (mambuhl AT earthlink DOT net) Ah! but it is something to have at least the choice of nightmares. - Joseph Conrad