Article View: comp.os.os2.programmer
Article #1224Re: C Set/2 Question in malloc
From: Greg Roelofs
Date: Fri, 28 Aug 1992 17:03
Date: Fri, 28 Aug 1992 17:03
17 lines
1084 bytes
1084 bytes
First of all, there was no reason to crosspost this query. Follow-ups to c.o.os2.programmer. uma@natinst.com (Uma Arunkumar) writes: >SAMPLE.C(12:15) : error EDC0117: The operation between these types is not valid. >SAMPLE.C(12:10) : informational EDC0140: Operand has type pointer to signed long integer . >SAMPLE.C(12:17) : informational EDC0140: Operand has type signed integer . > > if (( array= malloc(50 * sizeof(long)))!= NULL) > >What is wrong in the above code? Exactly what it tells you: malloc() is assumed to return int by default. Add (long *) in front of it. Greg Roelofs
Technical Details
Message-ID:
<1992Aug28.170307.21637@riacs.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!riacs!pan.arc.nasa.gov!roelofsReferences:
<1992Aug28.154836.12867@natinst.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer,comp.os.os2.apps,comp.os.os2.misc Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!riacs!pan.arc.nasa.gov!roelofs From: roelofs@pan.arc.nasa.gov (Greg Roelofs) Subject: Re: C Set/2 Question in malloc Message-ID: <1992Aug28.170307.21637@riacs.edu> Followup-To: comp.sources.programmer Sender: news@riacs.edu Organization: University of Chicago References: <1992Aug28.154836.12867@natinst.com> Date: Fri, 28 Aug 92 17:03:07 GMT Lines: 17