I built a code that does your algorithm using function i have build.
I think there is problem in the array input on the signatures
how input an array
i tried int* matrix[][]
??
Code:
#include <stdio.h>
int main() { //star
int i,j,k,temp,sum3=0,total_sum=0,inp,sum2=0;
int rows = 50;
int cols = 50;
int jndex,input,counter=0;
int matrix[50][50];
// int matrix[rows][cols];
// int sum[rows][cols];
int sum[50][50];
// int temp1[rows][cols];
int temp1[50][50];
// int transpose [cols][rows];
int transpose [50][50];
int index,kndex,tndex,gndex,lndex;
int rows_sum[50];
printf("enter the size of a matrix:");
scanf("%d %d",&rows,&cols);
for (index = 0; index < rows; index++)
{
rows_sum[index]=0;
for (kndex = 0; kndex < cols; kndex++)
{
matrix[index][kndex] = 0;
sum[index][kndex] = 0;
temp1[index][kndex] = 0;
transpose[index][kndex] = 0;
}//end inner for
}//end outer for
printf("enter numbers in a row for a matrix:"); //stat input
for (index =0;index<rows; index++)
{
for (kndex =0; kndex<cols; kndex++)
{
scanf("%d", &matrix[index][kndex]);
transpose[kndex][index] = matrix[index][kndex];
}
}
i = getchar(); //needed because of scanf()
//end input
printf(" enter number to search");
scanf("%d", &inp);
for (index=0;index<rows; index++)
{
for (kndex =0; kndex<cols; kndex++)
{
sum3=search(inp ,i,j,rows,cols,matrix[][]);
total_sum=total_sum+sum3;
}
}
// }
// }
// }
//}
printf("%d",&counter);
// end of searching code
return 0;
}//end main
int search(int input,int cor_row,int cor_col,int rows ,int cols,int* matrix[][]){//start search func
int i,j,sum,counter=0;
for ( i=rows;i>0;i--){
for ( j=cols;j>0;j--){
sum=sum_of_matrix(cor_row, cor_col,i ,j, matrix [][]);
if (input==sum){
counter++;
}
}
}
return counter;
}//end search func
int sum_of_matrix(int cor_row,int cor_col,int rows ,int cols,int* matrix [][]){
int i ,j;
int sum=0;
for (i=cor_row;i<rows;i++){
for (j=cor_col;i<cols;i++){
sum=sum+matrix[i][j]
}
}
return sum;
}