Segmentation Fault - declare and init array in C

后端 未结 3 1574
渐次进展
渐次进展 2021-01-28 10:12

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
t         


        
3条回答
  •  梦如初夏
    2021-01-28 10:13

    You have not allocated any memory to hold the float values. Prior to the memcpy you need something like:

    A.elts = malloc(9* sizeof(float));

提交回复
热议问题