aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorkrolyxon <krolyxon@tutanota.com>2023-08-31 08:39:20 +0530
committerkrolyxon <krolyxon@tutanota.com>2023-08-31 08:39:20 +0530
commitf94f903987b167b0bc641aeabe20c708a0cc0a6f (patch)
tree50f88d391d3628d8d3367c63df85d595db8f77ba /src/utils.c
Initial Commit
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..390aa7c
--- /dev/null
+++ b/src/utils.c
@@ -0,0 +1,26 @@
+#include "utils.h"
+#include <stdio.h>
+
+void printarr(int a[], int n) {
+ for (int i = 0; i < n; i++) {
+ printf("%d ", a[i]);
+ }
+}
+
+void print_ascii(char *filename) {
+ char read_string[MAX_LEN];
+ FILE *fptr = NULL;
+ if ((fptr = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "error opening %s\n", filename);
+ }
+ while (fgets(read_string, sizeof(read_string), fptr) != NULL) {
+ printf("%s", read_string);
+ }
+ fclose(fptr);
+}
+
+void swap(int a[], int i, int j) {
+ int tmp = a[i];
+ a[i] = a[j];
+ a[j] = tmp;
+}