Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uwm.edu!ux1.cso.uiuc.edu!s.psych.uiuc.edu!amead From: amead@s.psych.uiuc.edu (alan mead) Newsgroups: comp.lang.pascal Subject: Re: Variable sized arrays? Message-ID: <1991Apr21.211234.17738@ux1.cso.uiuc.edu> Date: 21 Apr 91 21:12:34 GMT References: <1991Apr21.083641.18707@usenet.ins.cwru.edu> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 21 wct@po.CWRU.Edu (William C. Thompson) writes: >I don't suppose there is ANY way possible to have a variable >sized array, is there. Maybe in 6.0? I need to save a Where there's a will there's a way. In fact, I just posted about it. You need to declare a type array of ___[1..] and then declare a pointer to it. You can then use GetMem() to allocate exactly enough memory (ie, what makes this technique dynamic is that GetMem decides how much memory to use). I think GetMem() requires that 64K or less is requested--if you want more, you have to turn off range checking AND request multiple 64K *contiguous* chunks (I think--I'm not sure if it's always an error to use an index greater than 65535). Check out my post if it's still around. It's titled "need array on heap" or something (or else I'll send it by email). -alan