#include<stdio.h>
#include<string.h>
#define MAX_VAL 100
//Function declaration
int input_values(int Z[][k], int j, int k);
int main(void)
{
 int A(int [ ][k], int, int);
 int m, n;
 char comm[100];
 while(1){
  printf("\n>>");
  gets(comm);
   if(strcmp(comm,"MAKE A")== 0)
    input_values(A, j, k  );
  }  
}
//make or overwrite matrix
int input_values(int Z[][k], int j, int k)
{
 int row, col;
 //DETERMINING THE SIZE OF MATRIX
  do{
   printf("Enter the number of rows: ");
   scanf("%d", &row);
    if(row>100)
     printf("Size is out of bounds! Size must be less than or equal to 100\n");
  }while(row>100);        
  do{
   printf("Enter the number of columns: ");
   scanf("%d", &col);
    if(col>100)
     printf("Size is out of bounds! Size must be less than or equal to 100\n");
  }while(col>100); 
 //ENTERING THE VALUES OF MATRIX
  for(j=0; j<row; j++)                                                                          
   for(k=0; k<col; k++){
    printf("A[%d][%d] = ", j, k);
    scanf("%d", &Z[j][k]);
    }
return Z[][];
}
views:
47answers:
1
                
                A: 
                
                
              Well, int Z[][k] isn't valid syntax in C. Not as a declaration  and not as a parameter. And it certainly isn't C#.
Furthermore, int A(int [ ][k], int, int); is a forward declaration for a function. It is not a match for the 1st parameter of input_values.
I'm guessing you ended up with this notation for A because it gives no syntax errors. That is because the C compiler just ignores the invalid k in there.
                  Henk Holterman
                   2010-08-14 12:43:44
                
              That's a good point.  But whatever the case, it's emphatically not C#.
                  Kirk Woll
                   2010-08-14 12:45:08
                thank you very much:) anyway, could you help me on how to pass 2d arrays to functions? thanks:)
                  
                   2010-08-14 12:50:26