Advent of Code

Check-in [431fcb199e]
Login

Check-in [431fcb199e]

Overview
Comment:202405 -- adjust array size
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 431fcb199e3639951b938c50e0b96e3417704ca1c50156929f0021073f22252d
User & Date: nnz on 2024-12-05 11:14:28
Other Links: manifest | tags
Context
2024-12-05
11:29
202405 -- read second part of data check-in: 712548bbdf user: nnz tags: trunk
11:14
202405 -- adjust array size check-in: 431fcb199e user: nnz tags: trunk
11:12
202405 -- read first part of data check-in: 7cae0b9197 user: nnz tags: trunk
Changes

Modified aoc2024.c from [e65661e9bd] to [6dba97d78d].

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20












-
+







#include <ctype.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aocdailies.h"
#include "aocutils.h"

void aoc202405(char *data, size_t len) {
    (void)len; // unused argument
    // assume (by visual inspection) all page numbers `pn` are between 10 and 99
    unsigned pagepair[2500][2], npp = 0;
    unsigned pagepair[1200][2], npp = 0;
    char *line = strtok(data, "\n");
    while (strchr(line, '|')) {
        char *err;
        pagepair[npp][0] = strtoul(line, &err, 10);
        err += 1; // skip '|'
        pagepair[npp][1] = strtoul(line, &err, 10);
        npp++;