Line 55: Char 44: runtime error: store to address 0x625000318040 with insufficient space for an object of type 'int *' (solution.c)


  1. 關注代碼邏輯,是否死循環(但是這個在簡單的示例中就能發現)
  2. 前期申請空間太多,合理安排內存申請
    // int **returnArr = (int **)malloc(sizeof(int *) * 1000);
    // *returnColumnSizes = (int *)malloc(sizeof(int) * 1000);
    int **returnArr = (int **)malloc(sizeof(int *) * (numsSize + 1) * 6);
    *returnColumnSizes = (int *)malloc(sizeof(int) * (numsSize + 1) * 6);

3.注意釋放內存
/**

  • Return an array of arrays of size *returnSize.
  • The sizes of the arrays are returned as *returnColumnSizes array.
  • Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
    */


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM