Advent of code 2025 (not proud)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

day 6 wip

+46
+41
day_6/6.c
··· 1 + #include <stdio.h> 2 + #include <stdlib.h> 3 + #include <string.h> 4 + 5 + 6 + int main(int argc, char* argv[]) { 7 + FILE* f = NULL; 8 + char* line = NULL; 9 + size_t size = 0; 10 + ssize_t nread = 0; 11 + int wrap_count = 0; 12 + int n_lengths = 0; 13 + int s_lengths = 0; 14 + f = fopen(argv[1], "r"); 15 + 16 + 17 + while ((nread = getline(&line, &size, f)) != -1 ) { 18 + if (!n_lengths) { 19 + n_lengths = nread; 20 + } else if (!s_lengths && n_lengths != nread) { 21 + s_lengths = nread; 22 + } // set long and short lenghts if wrapping is involved, for setting array sizes 23 + 24 + // lines will be written as they are to the char** lines pseudo matrix, and then transformed to int line by line if there is wrapping 25 + 26 + 27 + printf("%s",line); 28 + if (!strcspn(line, "*+")) { 29 + wrap_count++; 30 + } 31 + } 32 + 33 + 34 + 35 + printf("wrap count is: %d",wrap_count); 36 + free(f); 37 + free(line); 38 + 39 + 40 + return 0; 41 + }
+5
day_6/mini.txt
··· 1 + 123 328 51 64 2 + 45 64 387 23 3 + 6 98 215 314 4 + * + * + 5 +