| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| Message-ID: | <40894F42.B60859A7@yahoo.com> |
| From: | CBFalconer <cbfalconer AT yahoo DOT com> |
| Organization: | Ched Research |
| X-Mailer: | Mozilla 4.75 [en] (Win98; U) |
| X-Accept-Language: | en |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Trouble of using very large arrays |
| References: | <c68d6j$g57$03$1 AT news DOT t-online DOT com> <c68e70$96gqq$1 AT ID-231750 DOT news DOT uni-berlin DOT de> <c68u9l$9fevb$1 AT ID-79865 DOT news DOT uni-berlin DOT de> <urih80l3b6om4kbblr8jthpjbm1i7cp6gc AT 4ax DOT com> <4088E94D DOT 8070508 AT acm DOT org> <c6bafb$a9mhn$2 AT ID-227552 DOT news DOT uni-berlin DOT de> <c6bf2n$a164m$1 AT ID-79865 DOT news DOT uni-berlin DOT de> |
| Lines: | 27 |
| Date: | Fri, 23 Apr 2004 17:29:04 GMT |
| NNTP-Posting-Host: | 12.76.141.185 |
| X-Complaints-To: | abuse AT worldnet DOT att DOT net |
| X-Trace: | bgtnsc05-news.ops.worldnet.att.net 1082741344 12.76.141.185 (Fri, 23 Apr 2004 17:29:04 GMT) |
| NNTP-Posting-Date: | Fri, 23 Apr 2004 17:29:04 GMT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Alex Vinokur wrote:
> "Martin Ambuhl" <mambuhl AT earthlink DOT net> wrote in message
>> Cesar Rabak wrote:
>>> Brian Inglis escreveu:
>>
>>>> this is cleaner and more maintainable:
>>>>
>>>> a = malloc(rows * columns * sizeof *a);
>>>>
>>> This is not a good advice: you're changing the allocation of an
>>> object of (rows x columns) ints to another of (rows x columns)
>>> pointers to int.
>>
>> You are, I regret to say, in error. The type of *a is int, not
>> pointers-to-int.
>
> You are right. So,
> a = malloc(rows * columns * sizeof a);
^^
No no, 1000 times no, that should be "*a".
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |