| www.delorie.com/archives/browse.cgi | search | 
| From: | "A. Sinan Unur" <asu1 AT cornell DOT edu> | 
| Newsgroups: | comp.os.msdos.djgpp | 
| Subject: | Re: boo hoo. my code crashes. | 
| Date: | Wed, 19 Feb 1997 06:34:09 -0500 | 
| Organization: | Cornell University http://www.cornell.edu | 
| Lines: | 31 | 
| Sender: | asu1 AT cornell DOT edu (Verified) | 
| Message-ID: | <330AE531.669F@cornell.edu> | 
| References: | <5e5d6n$fda AT flex DOT uunet DOT pipex DOT com> <5ecmk3$esk$2 AT troll DOT powertech DOT no> | 
| Reply-To: | asu1 AT cornell DOT edu | 
| NNTP-Posting-Host: | cu-dialup-0010.cit.cornell.edu | 
| Mime-Version: | 1.0 | 
| To: | djgpp AT delorie DOT com | 
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp | 
Ove Kaaven wrote:
> nikki AT gameboutique DOT co (nikki) wrote:
> 
> >int huffman_encode ()
> >{
> >        struct node *histogram[NUM_SYMBOL_VALUES];
> >        struct node *huffman_tree;
> >        int encoded_stream_length;
> >        unsigned int i;
> >printf("a\n");
> >        /* initialize histogram */
> >        for (i=0; i<NUM_SYMBOL_VALUES; i++) histogram[i]= (struct node *) NULL;
> >printf("b\n");
> >}
> 
> "histogram" is a pointer to struct node, but does it point anywhere?
> I would recommend a malloc() call before writing into void:
> histogram=malloc(sizeof etc etc);
i would say it is an array of size NUM_SYMBOL_VALUES of pointers to
struct node.
   -- Sinan
 
*******************************************************************
 A. Sinan Unur                                WWWWWW
                                              |--O+O
 mailto:sinan DOT unur AT cornell DOT edu                C   ^ 
 http://www.people.cornell.edu/pages/asu1/     \  ~/ 
*******************************************************************
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |