Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!umigw!mthvax!dnelson From: dnelson@mthvax.cs.miami.edu (Dru Nelson) Newsgroups: comp.sys.apple2 Subject: Re: new() procedure in Pascal Message-ID: <1990Sep11.131547.1259@mthvax.cs.miami.edu> Date: 11 Sep 90 13:15:47 GMT References: <5429.26ec0e29@vax5.cit.cornell.edu> Distribution: comp Organization: University of Miami Department of Mathematics & Computer Science Lines: 27 Hello, >One more Pascal related question. When should I call the following? >var p:pointer (or StringPtr, or anything pointer) >begin >.... >new(p); >.... >end; >In other words, when do you have to call new()? Only when it is defined >in 'var' headings? Only global 'var' headings? How about as value parameters >of a procedure/function? I was writing a program that kept crashing >(corrputed string) until I called new(mystringptr). But I have made >other programs before that do similar things and I never used new(). I >am confused. Someone please help me. >Thanks >-- >Joel Sumner GENIE:JOEL.SUMNER These opinions are I think the problem is that you didn't allocate the memory for the string. See, you only allocated a pointer, not the data area where the string is supposed to go (ie. a new call, or array) -- %% Dru Nelson %% Miami, FL %% Internet: dnelson@mthvax.cs.miami.edu %%