Question: 2. Name this program two.c-This program reads the name of a square two-dimensional array, and the size of this array, from the command line. It

 2. Name this program two.c-This program reads the name of a

2. Name this program two.c-This program reads the name of a square two-dimensional array, and the size of this array, from the command line. It reads the array into memory and then calls a function that computes the sum of all values on the borders (edges) of the array. In the two examples below, the border elements are the elements shown in red. 12 3 4Given the file DATA1 shown at the left, running 5 6 7 8 the program /a.out DATA1 4 would result in 9 10 11 12 the answer 102 13 14 15 16 Given the file DATA2 shown at the 1 2 3 right, running the program /a.out 45 6 7 8 9 DATA2 3 gives the answer 40 The code below can be downloaded from Blackboard. You must write the function sumBorders (everything else already exists). Hint: make sure you handle the special case of a 1xl matrix. include #include int sumBorders (int *nt int main(int arge, char argvt1) FILE *fp= fopen (argv [1], "r"); int size = atoi (argv [2]); // allocate the matz int **matrix = malloc (sizeof (int *) for (inta-0 ; a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!