Skip to content

Commit

Permalink
2D array fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Coxall committed Dec 2, 2023
1 parent 0d7b67b commit 3db2bb5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions code_examples/5-Holding_Data/1-Arrays/4-Array_2D/C/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include <stdlib.h>
#include <time.h>

// In C an array is passed by reference to a function
// (C can not know the size of the array, so you need to pass it in as well)
// in C you must pass in the size of the 2D array to a function, first
int sumOfNumbers(int rows, int columns, int arrayOfNumbers[rows][columns]) {
// this function adds up all of the numbers in a 2D array

Expand Down
4 changes: 2 additions & 2 deletions docs/holding-data/2d-arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ Code for Creating and using a 2D Array
.. literalinclude:: ../../code_examples/5-Holding_Data/1-Arrays/4-Array_2D/C/main.c
:language: C
:linenos:
:emphasize-lines: 11-26, 30-33, 41, 49
:emphasize-lines: 11-25, 30-32, 40, 48
.. group-tab:: C++
.. code-block:: C++
.. literalinclude:: ../../code_examples/5-Holding_Data/1-Arrays/4-Array_2D/CPP/main.cpp
:language: C++
:linenos:
:emphasize-lines: 11-27, 31-34, 41, 49
:emphasize-lines: 12-29, 33-35, 41, 51

.. group-tab:: C#
.. code-block:: C#
Expand Down

0 comments on commit 3db2bb5

Please sign in to comment.