Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 03 Jun 2011 20:12:47 -0500 Message-ID: <4DE9868E.2099@mindspring.com> Date: Fri, 03 Jun 2011 21:12:46 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Questions Regarding Null and Casting References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 19 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.222.49 X-Trace: sv3-Vn3Ihrr7wz+lkPZpCJafKPhNUZOV8JamHiAHyuPBzGQc890HCQSI0W7/OqVHEZuZLFH7tRuChvUjSwP!v4QM3z/JpS5gA1rldebSe7cXmVw0fdXchzUsuAnE9aDh48KcH72evnNVOM9LG03PM+tGaR0X8eFZ!0wqjXSEtHQ== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1514 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:5406 Stefan Ram wrote: > > BigChuck19 writes: > >grades = (int *) malloc(numgrades * sizeof(int)); > >if (grades == (int *) NULL) { > > printf("Failed to allocate grades array"); > > exit(1); > >} > > I'd write this as: > > if( !grades ) > fprintf( stderr, "Failed to allocate grades array." ); else ... That string literal might be better if it had a newline character at the end. -- pete