Explore BrainMass
Share

Explore BrainMass

    A simple example of two-dimensional arrays in C

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a C function that adds the values of all elements in a two-dimensional array that is passed to the function, Assume that the array is an array of double-precision numbers having 4 rows and 5 columns.

    © BrainMass Inc. brainmass.com October 10, 2019, 3:43 am ad1c9bdddf
    https://brainmass.com/computer-science/c/simple-example-two-dimensional-arrays-c-432467

    Solution Preview

    The simplest way to sum up all of the elements of an array is to use a for loop to iterate over all of the elements. For a two dimensional array two for loops ...

    Solution Summary

    This solutions provides a simple and easy to understand example of how to use nested for loops to iterate over all of the elements of a two-dimensional array in C. It currently sums up all of the elements in the array but it can easily be extended to do other things with the elements of a two-dimensional array.

    $2.19