Skip to content

Instantly share code, notes, and snippets.

@skreuzer
Last active August 29, 2015 14:03
Show Gist options
  • Save skreuzer/62208e7fa3ccf922a844 to your computer and use it in GitHub Desktop.
Save skreuzer/62208e7fa3ccf922a844 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <time.h>
#ifndef isleap
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
#endif
int
main(int argc, char **argv)
{
int year = 0;
if(argc == 2) {
if(sscanf(argv[1], "%i", &year) == 1) {
if(isleap(year)) {
return 0;
} else {
return 1;
}
}
}
return 256;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment