From 42010cdeb3a97d0f6082c0202b5c27c95e4c6794 Mon Sep 17 00:00:00 2001
From: Florian Burgener <florian.burgener@etu.hesge.ch>
Date: Tue, 25 Jan 2022 15:10:25 +0100
Subject: [PATCH] Add constants

---
 ex1/ex1.c | 4 +++-
 ex2/ex2.c | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ex1/ex1.c b/ex1/ex1.c
index 5b34c5e..06f50f7 100644
--- a/ex1/ex1.c
+++ b/ex1/ex1.c
@@ -13,8 +13,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#define VALUES_LENGTH 8
+
 int main() {
-    int32_t values_length = 8;
+    int32_t values_length = VALUES_LENGTH;
     int32_t values[values_length];
 
     // Reading of the 8 input values.
diff --git a/ex2/ex2.c b/ex2/ex2.c
index f921868..90aee29 100644
--- a/ex2/ex2.c
+++ b/ex2/ex2.c
@@ -14,6 +14,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#define VALUES_LENGTH 4
+
 // LinkedListNode.h
 
 typedef struct LinkedListNode {
@@ -255,7 +257,7 @@ void linked_list_remove_at_index(LinkedList *list, int32_t index) {
 }
 
 int main() {
-    int32_t values_length = 4;
+    int32_t values_length = VALUES_LENGTH;
     int32_t values[values_length];
 
     // Reading of the 4 input values to be added to the list.
@@ -278,7 +280,7 @@ int main() {
     LinkedList *list = linked_list_new();
 
     // Addition of the 4 numbers read as input in the list.
-    for (int32_t i = 4 - 1; i >= 0; i -= 1) {
+    for (int32_t i = values_length - 1; i >= 0; i -= 1) {
         linked_list_add_last(list, values[i]);
     }
 
-- 
GitLab