diff options
author | Jack Sangdahl <[email protected]> | 2025-08-27 12:45:33 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-08-27 12:45:33 -0600 |
commit | 4552bcf5a4a356415e248dee3b201f0cea7205bb (patch) | |
tree | 9868465918c6a6841b84cd14d66923b993dd9d62 /readme.md | |
parent | f549305fb5ca531d29dce6c2c091560f44190443 (diff) | |
download | leetcode-4552bcf5a4a356415e248dee3b201f0cea7205bb.tar.gz leetcode-4552bcf5a4a356415e248dee3b201f0cea7205bb.zip |
chore: Refactor two_d_arr_init function
Return a pointer to a new struct, rather than initialise objects in an
existing struct
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -54,9 +54,8 @@ int func(int **edges, int edgesSize, int *edgesColSize); int main() { // edges = [[0,1],[0,2],[1,3],[1,4],[2,5],[2,6]] int edges_input[6][2] = {{0, 1}, {0, 2}, {1, 3}, {1, 4}, {2, 5}, {2, 6}}; - struct two_d_arr edges; - two_d_arr_init(&edges, ARRAY_SIZE(edges_input), ARRAY_SIZE(edges_input[0]), edges_input); + struct two_d_arr *edges = two_d_arr_init(ARRAY_SIZE(edges_input), ARRAY_SIZE(edges_input[0]), edges_input); int res = func(edges.arr, edges.row_size, edges.col_size); - two_d_arr_free(&edges); + two_d_arr_free(edges); } ``` |