create utils header

This commit is contained in:
anon 2024-12-06 21:09:44 +01:00
parent e8e9c3f496
commit c0d67edd47
2 changed files with 18 additions and 13 deletions

View File

@ -3,19 +3,6 @@
#include <string.h>
#include <ctype.h>
#define INITIALIZE_ARRAY(a, n, x) do {\
for (int i = 0; i < n; i++) { \
a[i] = x; \
} \
} while (0)
#define INITIALIZE_MATRIX(a, n, m, x) do {\
for (int i = 0; i < n; i++) { \
for (int h = 0; h < m; h++) { \
a[i][h] = x; \
} \
} \
} while (0)
//#define AS_SYMBOL(c) (c-'a')
#define AS_SYMBOL(c) c
#define ALPHABET_SIZE 128

18
source/util.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef UTIL_H
#define UTIL_H
#define INITIALIZE_ARRAY(a, n, x) do {\
for (int i = 0; i < n; i++) { \
a[i] = x; \
} \
} while (0)
#define INITIALIZE_MATRIX(a, n, m, x) do {\
for (int i = 0; i < n; i++) { \
for (int h = 0; h < m; h++) { \
a[i][h] = x; \
} \
} \
} while (0)
#endif