Skip to content

Commit bf42c91

Browse files
committed
doc: add documentation for destroy2DArray function
1 parent a8bbdf5 commit bf42c91

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

libs/utilities.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@
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+
*/
1124
void destroy2DArray(char** arr, int rows, int cols);
1225

1326
/**

0 commit comments

Comments
 (0)