home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / os2 / programm / 4528 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  1.4 KB

  1. Path: sparky!uunet!gatech!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
  2. From: dic5340@hertz.njit.edu (David Charlap)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: Re: C Set/2 Question in malloc
  5. Message-ID: <1992Aug28.210340.25423@njitgw.njit.edu>
  6. Date: 28 Aug 92 21:03:40 GMT
  7. References: <1992Aug28.154836.12867@natinst.com> <19920828.105606.807@almaden.ibm.com> <59958@mimsy.umd.edu>
  8. Sender: news@njit.edu
  9. Organization: New Jersey Institute of Technology, Newark, N.J.
  10. Lines: 22
  11. Nntp-Posting-Host: hertz.njit.edu
  12.  
  13. In article <59958@mimsy.umd.edu> pr@umiacs.umd.edu (Jesus Rodriguez) writes:
  14. >|> >
  15. >|> >SAMPLE.C(12:15) : error EDC0117: The operation between these types is not valid.
  16. >|> >SAMPLE.C(12:10) : informational EDC0140: Operand has type pointer to  signed long integer .
  17. >|> >SAMPLE.C(12:17) : informational EDC0140: Operand has type signed integer .
  18. >
  19. >|> >  if  (( array= malloc(50 * sizeof(long)))!= NULL)
  20. >
  21. >this line should read 
  22. >if (( array = (long *) malloc(50 * sizeof(long))) != NULL)
  23. >               ^^^^^^^ this is what needs to be added to the line.  
  24.  
  25. This shouldn't be a problem.  Under ANSI-C, malloc() is supposed to
  26. return a (void *), not the (int *) that Unix-C uses.  (void *) types
  27. are assignment compatible to any pointer type.
  28.  
  29.  
  30. -- 
  31.    |)  David Charlap           "I don't even represent myself
  32.   /|_  dic5340@hertz.njit.edu   sometimes so NJIT is right out!.
  33.  ((|,)
  34.   ~|~  Hi! I am a .signature virus, copy me into your .signature file.
  35.