Deutsch   English   Français   Italiano  
<ld19dnFa6idU1@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rbowman <bowman@montana.com>
Newsgroups: comp.os.linux.advocacy
Subject: Re: More Funny Stuff From Joel
Date: 13 Jun 2024 22:16:24 GMT
Lines: 28
Message-ID: <ld19dnFa6idU1@mid.individual.net>
References: <17d716103c089ab3$7951$675878$802601b3@news.usenetexpress.com>
	<ej496jd0tb59u2l0nqtghq3u9ahhmann3s@4ax.com>
	<lcjnnuF896hU5@mid.individual.net>
	<kma96j1no1tp926ctejldkdk2c19aeruft@4ax.com>
	<lcjvk1F9n7aU1@mid.individual.net>
	<2ej96j1mbvgiok4q5c57vdlo94itpfu5dt@4ax.com>
	<6664e989$0$2363151$882e4bbb@reader.netnews.com>
	<slrnv6f9fl.2hg.candycanearter07@candydeb.host.invalid>
	<66687931$0$3747328$882e4bbb@reader.netnews.com>
	<slrnv6ig9v.13pi.candycanearter07@candydeb.host.invalid>
	<66699f8c$0$966$882e4bbb@reader.netnews.com>
	<slrnv6l2vk.24pu.candycanearter07@candydeb.host.invalid>
	<666b0963$0$985$882e4bbb@reader.netnews.com>
	<ld0olnF7p22U1@mid.individual.net>
	<666b43c2$0$966$882e4bbb@reader.netnews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net OfwjAYbR8m4KZPu85InEOA6AS2cGXDMGngT7hqEtOy1OuEzoQv
Cancel-Lock: sha1:2cYnQnUxjhnbRL7AA8ii2eSXlcg= sha256:z/fKUg8UpEqW5BwpNsYJY2KEalpIMSZuYi6IiRpaffw=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
Bytes: 2565

On Thu, 13 Jun 2024 15:08:50 -0400, DFS wrote:

> - malloc the md_count[] array to size 9 (because there
>     are only 9 unique values in the size 10 dataset)

What memory location is  md_count[9]++  incrementing? For that matter what 
are the initial values of md_count[0] through md_count[8] ? 

I used  memset(&md_count, 0, sizeof md_count); with the original 
declaration or you could have used calloc().

Same difference. You wind up with something that's not an array of 
whatever random crap is on the stack. 

> - add return 0

picky, picky... I suppose you want 'int main(void)'  too. I can't remember 
the guy's name but he was a prolific author of programming books in the 
early '80s whose examples always started with  'void main(). If comments 
in programming forums could kill he would have had an early retirement.

Not for nothing but in VS Code if you don't initialize 'mode' at the point 
where it's used there is a red squiggle that pops up 'identifier "mode" is 
undefinedC/C++(20)'  It doesn't flag an uninitialized 'mean', although 
'mean += nums[len];' assumes it was 0.0.  Points to clang for that one.