I am very new to C. coming from Python, Java and C# worlds. This might be a stupid question but I am getting segmentation fault:
// struct for storing matrices
typedef struct {
int m;
int n;
float* elts;
} Matrix;
and in my main method:
Matrix A;
A.n = 3;
A.m = 3;
memcpy( A.elts, (float[]) {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f}, 9 * sizeof(float)); // seg fault because of this memcpy.
I also tried without the f, same issue.
Can you help please