View Single Post
Join Date: Oct 2008
Posts: 48
Reputation: atman is an unknown quantity at this point 
Solved Threads: 0
atman atman is offline Offline
Light Poster

simple program problem - need help

 
0
  #1
Nov 9th, 2008
Hello.,
Im learning C online, and one of the examples from the internet is this:

  1. #include <stdio.h>
  2.  
  3. int CalcVolume (int length, int width, int height);
  4.  
  5. void PrintIt (int vol);
  6.  
  7. void main()
  8. {
  9. int volume1, volume2;
  10. int x = 8, y = 15, z = 20;
  11. volume1 = CalcVolume (10, 20, 30);
  12. PrintIt (volume1);
  13. volume2 = CalcVolume (x, y, z);
  14. PrintIt (volume2);
  15. }
  16.  
  17. /* end of main */
  18.  
  19. int CalcVolume (int length, int width, int height)
  20.  
  21. {
  22.  
  23. int vol;
  24. vol = length * width * height;
  25. return vol;
  26. }
  27. /* end of CalcVolume */
  28.  
  29. void PrintIt (int vol)
  30. {
  31. printf("The volume is: %d\n", vol);
  32. }


but when im trying to compile it sais

ch5m.c: In function ‘main’:
ch5m.c:9: warning: return type of ‘main’ is not ‘int’

is there an error in the exesize?

Thanx!
Reply With Quote