77#include "./macros.h"
88#include "./patterns/main.h"
99
10- // TODO: Documentation
10+ /**
11+ * @brief Frees the memory allocated for a 2D array.
12+ *
13+ * This function deallocates the memory used by a 2D array of characters. It iterates through each
14+ * row, frees the memory allocated for each row, and then frees the memory allocated for the array
15+ * of row pointers.
16+ *
17+ * @param arr 2D array to be destroyed.
18+ * @param rows Number of rows in the 2D array.
19+ * @param cols Number of columns in the 2D array.
20+ *
21+ * @warning Ensure that the array has been dynamically allocated and that the number of rows and
22+ * columns are correctly specified to avoid undefined behavior.
23+ */
1124void destroy2DArray (char * * arr , int rows , int cols );
1225
1326/**
@@ -24,7 +37,10 @@ void destroy2DArray(char** arr, int rows, int cols);
2437 * string as input and returns an integer. The validator function should return
2538 * 1 if the input is valid, and 0 otherwise.
2639 *
27- * @return A pointer to the string entered by the user.
40+ * @return A pointer to the string entered by the user dynamically allocated in memory.
41+ *
42+ * @warning Ensure to free the returned pointer after use with the appropriate deallocation
43+ * functions to avoid memory leaks.
2844 */
2945char * getUserInputStr (char * message , char * onInvalidMessage , int strLength ,
3046 int (* validator )(char * userInput ));
@@ -42,7 +58,20 @@ char* getUserInputStr(char* message, char* onInvalidMessage, int strLength,
4258 */
4359int isStrIn (char * str , char * arr [], int arrLength );
4460
45- // TODO: Documentation
61+ /**
62+ * @brief Initializes a 2D array of characters.
63+ *
64+ * This function dynamically allocates memory for a 2D array of characters with the specified number
65+ * of rows and columns.
66+ *
67+ * @param rows Number of rows.
68+ * @param cols Number of columns.
69+ *
70+ * @return A pointer to the 2D array of characters.
71+ *
72+ * @warning Ensure to free the allocated memory using appropriate deallocation functions to avoid
73+ * memory leaks.
74+ */
4675char * * new2DArray (int rows , int cols );
4776
4877/**
0 commit comments