home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21680 < prev    next >
Encoding:
Text File  |  1993-01-22  |  2.8 KB  |  79 lines

  1. Path: sparky!uunet!usc!sdd.hp.com!hplabs!ucbvax!anon.penet.FI!an6034
  2. From: an6034@anon.penet.FI
  3. Newsgroups: comp.os.vms
  4. Subject: C problem
  5. Message-ID: <9301201500.AA20662@anon.penet.fi>
  6. Date: 20 Jan 93 14:51:44 GMT
  7. Sender: usenet@ucbvax.BERKELEY.EDU
  8. Organization: Anonymous contact service
  9. Lines: 68
  10.  
  11. X-Anon-To: INFO-VAX@SRI.COM
  12.  
  13. Hi VAX/VMS experts.
  14.  
  15. I have a very simple C question.  I have a sample C program that compiles and
  16. runs fine in a Borland C++ environment.
  17.  
  18. When I try to compile this program in a VAX/VMS (5.4-2) environment I get a
  19. warning message.  I have looked up the error message but it doesn't mean a
  20. thing to me.
  21.  
  22. Attached is the source and a sethost log of my compile.
  23.  
  24. Please help a student with out a clue?
  25.  
  26. ********************************************************************************
  27. cc example_1.c
  28.     void main(void){ /* begin main */
  29. %CC-W-INVMAINRETVAL, Return value of main function is not an integer type.
  30.         At line number 8 in $DISK:EXAMPLE_1.C;24.
  31.  
  32. %CC-I-SUMMARY, Completed with 0 error(s), 1 warning(s), and
  33.         0 informational messages.
  34.         At line number 29 in $DISK:EXAMPLE_1.C;24.
  35. ********************************************************************************
  36.  
  37. /*
  38. Example from the first day of class.  Will use for/next loop and
  39. while loop to illistait 'weak' data typing in 'C'.
  40. */
  41.  
  42. #include <stdio.h>
  43.  
  44. void main(void){ /* begin main */
  45.  
  46. char k; /* character looping variable */
  47. int  m; /* integer looping variable */
  48.  
  49. puts("Characters have number codes - using Character Variable");
  50.  
  51. for ( k=' '; k <= '~'; k++){           /* begin for loop                   */
  52.      if ((k-' ')%12==0) putchar('\n'); /* line feed every 12th iteration   */
  53.      printf("%2c%4d",k,k);             /* print the character variable     */
  54. }                                      /* end for loop                     */
  55. putchar('\n'); putchar('\n');
  56.  
  57. puts("Characters have number codes - using Integer Variable");
  58.  
  59. m=32;                                  /* initial value for intege         */
  60. while (m < 127) {                      /* begin while loop                 */
  61.      if ((m-32)%12==0) putchar('\n');  /* line feed every 12th iteration   */
  62.      printf("%2c%4d",m,m);             /* print the integer varaible       */
  63.      m++;                              
  64. }                                      /* end while loop                   */
  65. }                                      /* end main                         */
  66.  
  67. ********************************************************************************
  68.  
  69. So am I missing a compiler switch that will make it all ok??
  70.  
  71. TIA
  72.  
  73.  
  74. -------------------------------------------------------------------------
  75. To find out more about the anon service, send mail to help@anon.penet.fi.
  76. Due to the double-blind system, any replies to this message will be anonymized,
  77. and an anonymous id will be allocated automatically. You have been warned.
  78.  
  79.