Question: sum_2d_array.c #include #define LEN 10 int sum_two_dimensional_array(int a[][LEN], int n){ int i, j, sum = 0; for (i = 0; i int main(){ int numbers[2][LEN]
sum_2d_array.c
#include
#define LEN 10
int sum_two_dimensional_array(int a[][LEN], int n){ int i, j, sum = 0; for (i = 0; i
int main(){ int numbers[2][LEN] = {{1,2,3,4,5,6,7,8,9,10}, {2,3,4,5,6,7,8,9,10,11}};
printf("The sum of all elements of the array is: %d ", sum_two_dimensional_array(numbers, 2));
return 0; } -------------- makefile
sum-2d-array: sum-2d-array.c gcc -Wall -std=c99 sum-2d-array.c -o sum-2d-array
clean: rm -f sum-2d-array
------------------------
![sum_2d_array.c #include #define LEN 10 int sum_two_dimensional_array(int a[][LEN], int n){ int](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66efa74580d7f_95666efa744e616b.jpg)
This is based on Ch12, exercise 17. Recall how 2D arrays are represented in memory. You are provided a C file called sum-2d-array.c that contains the function sum_two_dimensional_array shown below. You are also provided a Makefile that compiles the program. Rewrite the given function to use pointer arithmetic instead of array subscripting. In other words, eliminate the variables i and j and all uses of the [ operator. Use a single loop instead of nested loops and do not change the function signature. int sum_ two_dimensional_array(int al l[LEN], int n)t int i, j, sum0; for (i -0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
