Question about return statements and C

I’m studying C right now and I’ve noticed that a lot of teachers end their main(){} with return 0. Not all. But some. I wondered if this was some sort of standard or tradition when writing programs in C. What might be the purpose of return 0. I imagine that it stabilizes something in the program but this is me guessing.

Often C uses the return value for an ‘error code’. 0 means a ‘clean’ return with no errors.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.