home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / os2 / programm / 4507 < prev    next >
Encoding:
Text File  |  1992-08-29  |  1.7 KB  |  69 lines

  1. Xref: sparky comp.os.os2.programmer:4507 comp.os.os2.apps:5617 comp.os.os2.misc:28481
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!news.dell.com!natinst.com!uma
  3. From: uma@natinst.com (Uma Arunkumar)
  4. Newsgroups: comp.os.os2.programmer,comp.os.os2.apps,comp.os.os2.misc
  5. Subject: C Set/2 Question in malloc
  6. Message-ID: <1992Aug28.154836.12867@natinst.com>
  7. Date: 28 Aug 92 15:48:36 GMT
  8. Sender: news@natinst.com
  9. Organization: National Instruments, Austin, TX
  10. Lines: 56
  11. Nntp-Posting-Host: falcon.natinst.com
  12.  
  13.  
  14.  
  15. ****************** C Set/2   QUESTION ************************
  16. I am trying to compile a small program (to solve a problem in a huge program)
  17. in C Set/2 version 1.00.
  18. This program was taken from the C Set/2 Program Example given for malloc
  19. using KWIKINF.
  20.  
  21. ***************************************************************
  22. The program is given below:
  23.        
  24. #include <stdio.h>
  25. #include<malloc.h>
  26. main()
  27. {
  28.    char str[50];
  29.    long  *array;
  30.    int i;
  31.    for (i=0; i<50; i++)
  32.        str[i]='m';
  33.  
  34.   if  (( array= malloc(50 * sizeof(long)))!= NULL)
  35.      for (i=0; i<50; i++)
  36.        *array++=1;
  37.  
  38. }
  39.    
  40. *********************************************************
  41.  
  42. When I compile giving the command 
  43.             icc /c /w3 /o+ sample.c 
  44.  
  45.        I get the following error messages:
  46.  
  47.  
  48. SAMPLE.C(12:15) : error EDC0117: The operation between these types is not valid.
  49. SAMPLE.C(12:10) : informational EDC0140: Operand has type pointer to  signed long integer .
  50. SAMPLE.C(12:17) : informational EDC0140: Operand has type signed integer .
  51.  
  52.  
  53. This program compiles without any error in C compiler in Sun.
  54.  
  55. What is wrong in the above code?
  56.  
  57.  
  58. I WOULD HIGHLY APPRECIATE SOME HELP.
  59.  
  60. Thanks in advance.
  61.  
  62. My Email address is uma@natinst.com.
  63.  
  64. uma.
  65.  
  66.  
  67.        
  68.    
  69.