我在C语言方面比较新,试图运行一个简单的程序时,却收到了如下错误信息:段错误(core dumped)。我只是想打印数组bits中的任何值,但我无法做到,如果有人能帮我解决这个错误,我将不胜感激。
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <malloc.h>
int main()
{
const long int N = 1000000000;
const int smallN = 125000000;
char bits[smallN];
for(int i=0; i<smallN; i++){
bits[i]=0xff;
}
printf("character = %c \n", bits[5]);
}