delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/22/14:45:19

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: nasty problems with free()
Date: 22 Apr 2001 11:36:46 -0700
Organization: InterWorld Communications
Lines: 18
Sender: nate AT mercury DOT st DOT hmc DOT edu
Message-ID: <83itjw3hoh.fsf@mercury.st.hmc.edu>
References: <3ae2dc55 DOT 2557776 AT news DOT dingoblue DOT net DOT au> <3AE30C3C DOT 80F5CCCB AT jps DOT net> <3ae30e53 DOT 7311315 AT news DOT dingoblue DOT net DOT au>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 987964606 70933 134.173.57.219 (22 Apr 2001 18:36:46 GMT)
X-Complaints-To: usenet AT news DOT interworld DOT net
NNTP-Posting-Date: Sun, 22 Apr 2001 18:36:46 +0000 (UTC)
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

gehok55 AT hotmail DOT com (Josh) writes:

> how can i fix this?
> can i initialise *p after i do the scanf?
> it didnt seem to like that.

Sure.

int n;
Point *p;

scanf("%d", &n)
p = calloc(n, sizeof(Point));

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019