Re: C or C++ for FOSS/linux?
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Fri, 29 Dec 2006 13:43:45 -0500
On 2006-12-29, Sebastian 'lunar' Wiesner wrote:
Jan Panteltje <pNaonStpealmtje@xxxxxxxxx> typed[snip]
int *i = (int *) malloc (100*sizeof(int));
I don't know much of C programming, but that is known to me as the way
you allocate an array of 100 integers on the heap in C.
Wrong; it's:
int *i = malloc (100*sizeof(int));
You should not cast the value returned by malloc; that can mask
errors.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.
- Follow-Ups:
- Re: C or C++ for FOSS/linux?
- From: Sebastian 'lunar' Wiesner
- Re: C or C++ for FOSS/linux?
- From: Hadron
- Re: C or C++ for FOSS/linux?
- References:
- C or C++ for FOSS/linux?
- From: Beowulf
- Re: C or C++ for FOSS/linux?
- From: Jan Panteltje
- Re: C or C++ for FOSS/linux?
- From: Sebastian 'lunar' Wiesner
- Re: C or C++ for FOSS/linux?
- From: Jan Panteltje
- Re: C or C++ for FOSS/linux?
- From: Sebastian 'lunar' Wiesner
- Re: C or C++ for FOSS/linux?
- From: Jan Panteltje
- Re: C or C++ for FOSS/linux?
- From: Sebastian 'lunar' Wiesner
- C or C++ for FOSS/linux?
- Prev by Date: Re: C or C++ for FOSS/linux?
- Next by Date: Re: C or C++ for FOSS/linux?
- Previous by thread: Re: C or C++ for FOSS/linux?
- Next by thread: Re: C or C++ for FOSS/linux?
- Index(es):
Relevant Pages
|