www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/16/16:15:52

From: "Edd Dawson" <hotcakes AT planetquake DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <b07318$3eg$1 AT news DOT online DOT de>
Subject: Re: sizeof(struct x) doesn't compile -- how to do it ?
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <L8FV9.475$Qb4.259@news-binary.blueyonder.co.uk>
Date: Thu, 16 Jan 2003 21:10:19 -0000
NNTP-Posting-Host: 80.192.72.44
X-Complaints-To: abuse AT blueyonder DOT co DOT uk
X-Trace: news-binary.blueyonder.co.uk 1042751147 80.192.72.44 (Thu, 16 Jan 2003 21:05:47 GMT)
NNTP-Posting-Date: Thu, 16 Jan 2003 21:05:47 GMT
Organization: blueyonder (post doesn't reflect views of blueyonder)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

-snip-
> int main()
>  {
>   x* n=malloc(2*sizeof(struct x));
>  }

Should this be:

int main()
{
   struct x *x_array;
   (void*)x_array = malloc(2*sizeof(struct x));

   free(x_array); /* don't forget to free ;)  */
}

?
Edd



- Raw text -


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