作用一样的语句为什么只有一条报错呢

  int ans[numsSize];
  报错:Line 207: Char 3: runtime error: load of null pointer of type 'int' [__Serializer__.c]
  int* ans = malloc(sizeof(int) * numsSize);

这两个的作用不都是一样的吗,那为什么在leetcode上第一条却报错呢?

当然不一样,一个是动态分配内存