Assigning Values To An Array
One uses a bidimensional array and the other one uses a simple array: with no need to make any other modifications to the program.
At some moment we may need to pass an array to a function as a parameter.
In order to accept arrays as parameters the only thing that we have to do when declaring the function is to specify in its parameters the element type of the array, an identifier and a pair of void brackets loop that prints out the array to know the range to iterate in the passed array without going out of range.
In a function declaration it is also possible to include multidimensional arrays.
Swift makes it easy to create arrays in your code using an array literal: simply surround a comma-separated list of values with square brackets.In C it is not possible to pass a complete block of memory by value as a parameter to a function, but we are allowed to pass its address.In practice this has almost the same effect and it is a much faster and more efficient operation.The elements of global and static arrays, on the other hand, are automatically initialized with their default values, which for all fundamental types this means they are filled with zeros.In both cases, local and global, when we declare an array, we have the possibility to assign initial values to each one of its elements by enclosing the values in braces would be 5 ints long, since we have provided 5 initialization values.Arrays, both simple or multidimensional, passed as function parameters are a quite common source of errors for novice programmers.I recommend the reading of the chapter about Pointers for a better understanding on how arrays operate.The new storage is a multiple of the old storage’s size.This exponential growth strategy means that appending an element happens in constant time, averaging the performance of many append operations.Append operations that trigger reallocation have a performance cost, but they occur less and less often as the array grows larger.If you know approximately how many elements you will need to store, use the Each array has an independent value that includes the values of all of its elements.