Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Long Question: What might cause the seg fault? |
| Date | 2016-06-22 00:25 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <nkclts$aod$1@reader1.panix.com> (permalink) |
| References | <nkcdmc$usf$1@dont-email.me> <nkcgea$776$1@dont-email.me> |
In <nkcgea$776$1@dont-email.me> BartC <bc@freeuk.com> writes:
> > float *fw1,*fw2,*fw3,*fk1;
> > int *fxf,*fyf,*fxof,*fyof,*fxm,*fym,*fdelay,*fglen;
> > if (nx==0) // nx was init. to 0
> > {
> > if ((fw1 = malloc(nfgraf * sizeof(float))) == NULL)
> > printf("malloc error\n");
> It seems those pointers (fxm etc) are only initialised when nx is 0;
> next time, nx is 1 (?), but the pointers will not retain their previous
> values. Try this:
> static int *fxf,*fyf,*fxof,*fyof,*fxm,*fym,*fdelay,*fglen;
This explains a lot. I wondered why the heck the mallocs were gated
behind the if...
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Long Question: What might cause the seg fault? bilsch <king621@comcast.net> - 2016-06-21 15:04 -0700
Re: Long Question: What might cause the seg fault? BartC <bc@freeuk.com> - 2016-06-21 23:51 +0100
Re: Long Question: What might cause the seg fault? BartC <bc@freeuk.com> - 2016-06-21 23:53 +0100
Re: Long Question: What might cause the seg fault? bilsch <king621@comcast.net> - 2016-06-22 01:55 -0700
Re: Long Question: What might cause the seg fault? John Gordon <gordon@panix.com> - 2016-06-22 00:25 +0000
Re: Long Question: What might cause the seg fault? Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-21 19:22 -0400
Re: Long Question: What might cause the seg fault? John Gordon <gordon@panix.com> - 2016-06-22 00:17 +0000
Re: Long Question: What might cause the seg fault? "James R. Kuyper" <jameskuyper@verizon.net> - 2016-06-21 19:35 -0400
Re: Long Question: What might cause the seg fault? bilsch <king621@comcast.net> - 2016-06-22 03:36 -0700
Re: Long Question: What might cause the seg fault? John Gordon <gordon@panix.com> - 2016-06-22 00:29 +0000
Re: Long Question: What might cause the seg fault? bilsch <king621@comcast.net> - 2016-06-22 03:38 -0700
Re: Long Question: What might cause the seg fault? Barry Schwarz <schwarzb@dqel.com> - 2016-06-21 21:20 -0700
csiph-web