advent2021

Advent of Code 2021 Solutions
git clone git://bsandro.tech/advent2021
Log | Files | Refs | README | LICENSE

main.c (665B)


      1 #include <stdio.h>
      2 #include <time.h>
      3 #include <string.h>
      4 
      5 void puzzle(const char *filename, long long *res1, long long *res2);
      6 
      7 int main(int argc, char *argv[]) {
      8 	printf("Advent of Code: day 08\n");
      9 	double time_start = clock();
     10 
     11 	if (argc <= 0) {
     12 		return -1;
     13 	}
     14 
     15 	if (argc == 1) {
     16 		printf("Usage: %s inputfile.txt\n", argv[0]);
     17 		return -1;
     18 	}
     19 
     20 	const char *filename = argv[1];
     21 
     22 	long long counter1 = -1;
     23 	long long counter2 = -1;
     24 
     25 	puzzle(filename, &counter1, &counter2);
     26 
     27 	printf("Puzzle #1: %lld\n", counter1);
     28 	printf("Puzzle #2: %lld\n", counter2);
     29 
     30 	double elapsed = clock() - time_start;
     31 	printf("Elapsed: %f\n", elapsed / CLOCKS_PER_SEC);
     32 
     33 	return 0;
     34 }