So I have been coding in C for a while now, but one thing that still confuses me is the "return" at the end of functions.
Now I know that return is the value, which a function returns when called by main.
But what does "return 0" mean in main() function of C? I also did the following-
#include <stdio.h>
int main()
{
printf("Hello world");
return 0;
}
And then, I did this-
#include <stdio.h>
int main()
{
printf("Hello world";
return -1;
}
And then I finally did this-
#include <stdio.h>
int main()
{
printf("Hello world";
return 45;
}
They all compile fine and run, but what do these "return" do in each case of the above code. Please explain in detail about this return and what happens in these 3 cases.