Article View: comp.os.os2.programmer
Article #1240Re: C Set/2 Question in malloc
From: David Charlap
Date: Fri, 28 Aug 1992 21:03
Date: Fri, 28 Aug 1992 21:03
22 lines
1504 bytes
1504 bytes
In article <59958@mimsy.umd.edu> pr@umiacs.umd.edu (Jesus Rodriguez) 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) > >this line should read >if (( array = (long *) malloc(50 * sizeof(long))) != NULL) > ^^^^^^^ this is what needs to be added to the line. This shouldn't be a problem. Under ANSI-C, malloc() is supposed to return a (void *), not the (int *) that Unix-C uses. (void *) types are assignment compatible to any pointer type. -- |) David Charlap "I don't even represent myself /|_ dic5340@hertz.njit.edu sometimes so NJIT is right out!. ((|,) ~|~ Hi! I am a .signature virus, copy me into your .signature file.
Technical Details
Message-ID:
<1992Aug28.210340.25423@njitgw.njit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!gatech!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340References:
<1992Aug28.154836.12867@natinst.com> <19920828.105606.807@almaden.ibm.com> <59958@mimsy.umd.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340 From: dic5340@hertz.njit.edu (David Charlap) Newsgroups: comp.os.os2.programmer Subject: Re: C Set/2 Question in malloc Message-ID: <1992Aug28.210340.25423@njitgw.njit.edu> Date: 28 Aug 92 21:03:40 GMT References: <1992Aug28.154836.12867@natinst.com> <19920828.105606.807@almaden.ibm.com> <59958@mimsy.umd.edu> Sender: news@njit.edu Organization: New Jersey Institute of Technology, Newark, N.J. Lines: 22 Nntp-Posting-Host: hertz.njit.edu