mirror of
https://gitlab.gwdg.de/j.hahn02/university.git
synced 2026-01-01 06:44:25 -05:00
refactor various files
This commit is contained in:
31
S1/GdCP/uebung/aoc18.c
Normal file
31
S1/GdCP/uebung/aoc18.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void mix(long *n, long r) { *n = *n ^ r; }
|
||||
void prune(long *n) { *n = *n % 16777216; }
|
||||
|
||||
int main() {
|
||||
FILE *file = fopen("18.in", "r");
|
||||
if (!file) {
|
||||
perror("Unable to open file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int size = 71;
|
||||
int **a = malloc(size * sizeof(int *));
|
||||
for (int i = 0; i < size; i++) {
|
||||
a[i] = malloc(size * sizeof(int));
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
perror("Memory allocation failed");
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
free(a);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user