While learning C++ i have seen a lot of example codes. But there is something i do not understand. Sometimes int is used to declare a function but other times void is used instead.
What is the difference between int and void, and where would i use them.
Also a function can be made to return any previously defined data type, not just 'int' or 'void'. What you are probably seeing if you're a beginner is the assignment of a data type to "main(...)" in which case the proper standard is to always return an 'int'. It used to be acceptable to return 'void' from a programs entry point but modern operating systems are designed to expect something from your application so the practice is now discouraged.