by defrost · 3y ago · 0 comments
Although even things in the C FAQ get overlooked and forgotten.
eg: a 'Day of the Week' one liner such as
dow = (y + y/4 - y/100 + y/400 + m["-bed=pen+mad."] + d) % 7;
with int day (d), month (m), year (y) inputs and single int day of week output has a slight twist that causes a few head scratches for some.
y -= m < 3; dow = as above, etc;
I was focused on an 'obscure' yet fundemental part of the C language pointer | array equivalence.
Addendum: https://c-faq.com/misc/zeller.html