Explore BrainMass

Explore BrainMass

    A simple example of two-dimensional arrays in C

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    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 September 27, 2022, 5:39 pm ad1c9bdddf

    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.