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

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

Path: ...!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: 14 Jun 2024 16:46:40 GMT
Lines: 32
Message-ID: <ld3affFja99U1@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>
	<ld19dnFa6idU1@mid.individual.net>
	<666c4979$0$2363133$882e4bbb@reader.netnews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net gpQAZMKaTcg9by9sfkpDyggwqnJ9Z+TYBH+ElzzHrZ4EM7Yffr
Cancel-Lock: sha1:+UHXlXbfjaKpBSqy93pAG5R920s= sha256:Yna7ibnPXCB9XP01H9gPJhsSilv9RpU8+qkPOs/dLgc=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
Bytes: 2497

On Fri, 14 Jun 2024 09:45:29 -0400, DFS wrote:

> On 6/13/2024 6:16 PM, rbowman wrote:
>> 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?
> 
> 9 is the correct size for md_count[], but then you have to play games
> with index addressing and looping.
> 
> So malloc() to size 10 and life's good.

Right. Did you play games with the index when you malloc'd 9? 

>> For that matter what are the initial values of md_count[0] through
>> md_count[8] ?
> 
> 0.

man malloc

The  malloc()  function  allocates size bytes and returns a pointer to the 
allocated memory.  The memory is not initialized.  If size is 0, then  
malloc()  returns  either  NULL,  or  a  unique pointer value that can 
later be successfully passed to free().

'The memory is not initialized.'  is underlined on the man page. Some days 
you get lucky.