力扣 报错 runtime error: load of null pointer of type 'const int'

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

要求返回的是int*
1234831-20190403143615296-149323577.png

解决方案

1.指针使用malloc分配空间

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

2.使用static

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

转载于:https://www.cnblogs.com/lick468/p/10648771.html

你可能感兴趣的:(runtime)