I've been programming in C++ for quite some time now and I know all functions must return a value.. but can someone tell me WHY we return 0?
I mean it compiles even when I don't put return 0.. and the program executes fine.. I can see in some functions we'd return a variable or a value.. but for int main() why do we always have to write return 0? Someone told me its the new standard that we don't have to type it anymore but I'm so used to return 0 that I can't not type it. I also heard its because when a function returns a value other than 0, it means something is wrong and the operating system can check the value it returned and check for memory leaks or something..
what if I returned 256? it still works.. :c
also can someone explain when i use unsigned variables?? I never use them unless a function on MSDN requires it.. so is there any use of them other than passing them to functions as parameters? Oh and when do we use constants? I mean I can just use a float or integer instead of const int or const float.. just don't change the value right? When do we use constants :S
I saw someone do this:
const float PI = 3.14159265f;
const float DEGREE_TO_RADIAN_FACTOR = 0.0174532925f;
can someone explain why there is an "f" at the end of the values??
Thanks in advance.