I'm trying to assign multidimensional array to unitilized array in struct like this:
typedef struct TestStruct
{
int matrix[10][10];
} TestStruct;
TestStruct *Init(void)
{
TestStruct *test = malloc(sizeof(TestStruct));
test->matrix = {{1, 2, 3}, {4, 5, 6}};
return test;
}
I got next error:
test.c:14:17: error: expected expression before '{' token
test->matrix = {{1, 2, 3}, {4, 5, 6}};
What is the best way in C to assign matrix?