runtime error: load of null pointer of type 'const int'

要求返回的是int*
力扣 报错 runtime error: load of null pointer of type 'const int'

1.指针使用malloc分配空间

int * p = (int * )malloc(sizeof(int)*2);取代 int a[2]={0};

2.使用static

static int a[2]={0}; 取代 int a[2]={0};

相关文章:

  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2021-12-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2021-06-15
  • 2021-09-16
相关资源
相似解决方案