C: explain if(exit(0),0){} line of code
I am learning C and as an exercise, I'm trying to write a simple program without any semicolons. I've had some trouble with replacing return 0 statement but I've found that this is (the only?) way to do it in C: if(exit(0),0){} . How exactly does this statement work? I know that exit() from stdlib is a void function but I don't understand what the ,0 part in the if works (the rest is clear to me). The , operator in C evaluates both its arguments, and returns the value of the second one. So the expression exit(0), 0 calls exit(0) and returns 0. So the code you posted is effectively equivalent