www.delorie.com/archives/browse.cgi | search |
From: | ovek AT arcticnet DOT no (Ove Kaaven) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: boo hoo. my code crashes. |
Date: | Mon, 17 Feb 1997 16:28:28 GMT |
Organization: | Vplan Programvare AS |
Lines: | 32 |
Message-ID: | <5efi2c$pst$1@troll.powertech.no> |
References: | <5e5d6n$fda AT flex DOT uunet DOT pipex DOT com> <5ecmk3$esk$2 AT troll DOT powertech DOT no> |
NNTP-Posting-Host: | alwayscold.darkness.arcticnet.no |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
asu1 AT cornell DOT edu (A. Sinan Unur) wrote: >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. Really? Hmm... I knew there had to be a reason for my irrational use of parentheses. Allright, I tested the code, and it works fine for me. So it probably only crashes in a larger context (a big program?). A possible stack overflow? See if increasing stack size might help.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |