I don't know.. it has such gems as 2-dimensional pointers and apparently passing a pointer to a pointer is passing by reference. I never knew. I always thought you passed by reference to pass by reference!
Ahh, perspective, one views it as something and other views as something else!!!@Moschops:please google on how to use main function or main function types in c++.
@anirudh sn: Are you suggesting Moschops doesn't know how to use main? The C++ standard specifically states that the return type of main must be int. It does kind of suck how many compilers and tutorials allow void. MSVC++ allows void without a single complaint.
@szak1592: As Moschops so cleverly pointed out, it depends on implementation. The '*' operator is the dereference operator, which returns the object at an address, and the '&' operator is the address-of operator, which returns the address of an object.
The ISO C++ standards made it very clear (in 1998, 2003 and again in 2011) that main returns an int. Using google will do no more than show up endless cases where people literally do not know what they are talking about and in many cases didn't even realise that C++ is defined by a paper document.
This seems to be a particular problem in parts of Asia, where the very common course textbooks incorrectly use void main(), and teachers commonly push their students into using compilers over a decade old (or that Microsoft travesty :) ) that wrongly accept it without so much as a warning.
I have never seen anything official that has ever stated that "void main() is valid". The only place where it could be valid is in a freestanding implementation of a compiler.
ofcourse it is not a good programming practise, but its not invalid,
It is as invalid as string main(), or bananasOnToast main(), or anything else. Everyone else here has read the relevant parts of the ISO standard; the actual C++ definition. You can stand there as long as you like saying "no, actually it's valid because it's in my textbook and my twenty year old compiler doesn't stop me using it"; it won't change the facts.