advent2023

Advent of Code 2023 solutions
git clone git://bsandro.tech/advent2023
Log | Files | Refs | LICENSE

main.c (726B)


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