advent2021

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

main.c (703B)


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