I get this error when I try to compile it :
‘struct TMatrix’ declared inside parameter list will not be visible outside of this definition or declaration
3 | int InputMatrix (struct TMatrix Matrix);
#include <stdio.h>
#define MAX 1000
int InputMatrix (struct TMatrix Matrix);
struct TMatrix{
int L, C;
};
int main() {
struct TMatrix Matrix;
InputMatrix(Matrix);
return 0;
}
int InputMatrix (struct TMatrix Matrix) {
}
The scope of the declaration of the structure
struct TMatrixwithin the function declarationis the parameter list. Outside it this declaration is invisible.
So this structure declaration
declares another structure in the file scope.
You need to exchange the declarations like
Or before the function declaration to place a forward declaration of the structure
Pay attention to that if you want to change the object of the structure type declared in main then you need to pass it to the function through a pointer to it. Otherwise the function parameter does not make a sense. That is the function should be declared like
and in main you should write