Hey,
First of all, am a noob in programming.. Am just starting to learn.. Now,
I use Dennis Ritchie's book "the c programming language" as reference for learning the C language... The examples he gave for running the hello world program and many many others all start with main() and that works fine when i use Visual studio to compile the program.. But when I use a compiler like Turbo C++, it says that the function should return a value.. So, I now have to add a void in front of main. And this is also taught in my college, that is to use void main().
My questions are:
1. Why does the program run in VS but not in TurboC++ when i use main() instead of void main()?
2. What should I use to compile? Which one is a better option?
3. If Dennis Ritchie himself wrote the code that way, why doesn't it work? And why are we taught so many things in college which differ from what the book states? Like in college we are taught to use getch() instead of getchar().
I am just confused about what's right and what's wrong!!!
First of all, am a noob in programming.. Am just starting to learn.. Now,
I use Dennis Ritchie's book "the c programming language" as reference for learning the C language... The examples he gave for running the hello world program and many many others all start with main() and that works fine when i use Visual studio to compile the program.. But when I use a compiler like Turbo C++, it says that the function should return a value.. So, I now have to add a void in front of main. And this is also taught in my college, that is to use void main().
My questions are:
1. Why does the program run in VS but not in TurboC++ when i use main() instead of void main()?
2. What should I use to compile? Which one is a better option?
3. If Dennis Ritchie himself wrote the code that way, why doesn't it work? And why are we taught so many things in college which differ from what the book states? Like in college we are taught to use getch() instead of getchar().
I am just confused about what's right and what's wrong!!!