main.c (796B)
1 #include <stdio.h> 2 #include <time.h> 3 #include <string.h> 4 #include <threads.h> 5 #include <stdatomic.h> 6 #include <stdlib.h> 7 8 void puzzle(const char *filename, long long *res1, long long *res2); 9 //void puzzle_test(const char *filename, long long *res1, long long *res2); 10 11 int main(int argc, char *argv[]) { 12 printf("Advent of Code: day 05\n"); 13 double time_start = clock(); 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 long long counter1 = -1; 22 long long counter2 = -1; 23 24 puzzle(filename, &counter1, &counter2); 25 26 printf("Puzzle #1: %lld\n", counter1); 27 printf("Puzzle #2: %lld\n", counter2); 28 29 double elapsed = clock() - time_start; 30 printf("Elapsed: %f\n", elapsed / CLOCKS_PER_SEC); 31 32 thrd_exit(EXIT_SUCCESS); 33 34 return 0; 35 }