Question: #include #include //FUNCTION DECLARATION double row_sum(double *ptrArray[], int row, int col); void invert(double *ptrArray[], int row, int col); void sortFirst(double *ptrArray[], int row, int col);
#include
#include
//FUNCTION DECLARATION
double row_sum(double *ptrArray[], int row, int col);
void invert(double *ptrArray[], int row, int col);
void sortFirst(double *ptrArray[], int row, int col);
double arr[3][3] =
{
{8,7,5},
{6,9,2},
{8,1,3},
};
double highestRowTotal = 0;
int i,j;
int main()
{
printf("Original Array ");
for(i = 0; i
for(j = 0; j
printf("%.2lf ",arr[i][j]);
}
printf(" ");
}
highestRowTotal = row_sum(arr,3,3);
printf(" Highest Row Total: %.2lf ", highestRowTotal);
printf(" Invert ");
invert(arr, 3, 3);
for(i = 0; i
for(j = 0; j
printf("%.2lf ",arr[i][j]);
}
printf(" ");
}
printf(" Sort First ");
sortFirst(arr, 3, 3);
for(i = 0; i
for(j = 0; j
printf("%.2lf ",arr[i][j]);
}
printf(" ");
}
return 0;
}
double row_sum(double *ptrArray[], int row, int col){
double rowOneSum = 0;
double rowTwoSum = 0;
double rowThreeSum = 0;
double tempNumber;
double highest;
for(i = 0; i
for(j = 0; j
if(i == 0) rowOneSum += arr[i][j];
if(i == 1) rowTwoSum += arr[i][j];
if(i == 2) rowThreeSum += arr[i][j];
}
}
double tempArray[3] = { rowOneSum, rowTwoSum, rowThreeSum };
for(i = 0; i
for(j = 0; j
if(tempArray[j] > tempArray[j+1]){
tempNumber = tempArray[j];
tempArray[j] = tempArray[j+1];
tempArray[j+1] = tempNumber;
}
}
}
highest = tempArray[2];
return highest;
}
void invert(double *ptrArray[], int row, int col){
double secondArray[3][3] = {{0}};
//ASSIGN TRANSPOSED VALUES TO NEW ARRAY
for(i = 0; i
for(j = 0; j
secondArray[j][i] = arr[i][j];
}
}
//ASSIGN NEW ARRAY VALUES TO ORIGINAL ARRAY
for(i = 0; i
for(j = 0; j
arr[i][j] = secondArray[i][j];
}
}
}
void sortFirst(double *ptrArray[], int row, int col){
double tempArrayOne[row][col];
double smallestValue = arr[0][0];
for(i = 0; i
for(j = 0; j
tempArrayOne[i][j] = arr[i][j];
}
}
for (i = 0; i
for (j = 0; j
if (tempArrayOne[i][j]
smallestValue = tempArrayOne[i][j];
tempArrayOne[i][j] = arr[0][0];
arr[0][0] = smallestValue;
}
}
}
}
Above is code from 'C' done in codeblocks. It runs but I get 3 warnings that I can't figure out. Can someone look at it. Below are the warnings.
![#include #include //FUNCTION DECLARATION double row_sum(double *ptrArray[], int row, int col); void](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3252b7920c_79466f3252adbe55.jpg)
22 arning: passing argument 1 of 'row sum' from incompatible pointer type [-V.. . 5 note: expected 'double **' but argument is of type 'double 3 27 warning : passing argument 1 of 'invert' from incompatible pointer type- 6 note: expected 'double **" but argument is of type 'double 31 37 arning: passing argument 1 of 'sortFirst' from incompatible pointer type [... 7 note: expected 'double *'but argument is of type 'double () [3] === Build finished: 0 error(s), 3 warning(s) (0 minute(s), o second (s))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
