I have the following structures.
typedef struct arr_integer
{
int size;
int *arr;
}arr_arr_integer;
arr_arr_integer alloc_arr_integer(int len)
{
arr_arr_integer a = {len, len > 0 ? malloc(sizeof(int) * len) : NULL};
return a;
}
What I intend to do is fill the matrix with the above structures. But I don't know how to manipulate the structure to fill the matrix.
Tried it this way, but I get an error.
int main(int argc, char const *argv[])
{
int len,rows,columns;
scanf("%d",&rows);
scanf("%d",&columns);
len = rows * columns;
arr_arr_integer Matrix = alloc_arr_integer(len);
for (int i = 0; i < rows ; i++)
{
for (int j = 0; j < columns; j++)
{
scanf("%d",&Matrix.arr[i].arr[j]);
}
}
return 0;
}