int m = 5, d = 12, y = 1975, val;
// May 12, 1975
Can someone please explain the function/purpose of the comma operator in the line of code below:
val = (d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7;
The above line was written by Mike Keith to calculate the day of the week given the date (d = day, m = month, y = year). Where Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6. I understand that the y-- gets executed if d+=m<3 is true, else the y-2 is executed. What I don't understand is the purpose of the comma after y-2.