The following code is segfaulting on me.
#include <stdio.h>
int main(int argc, char **argv)
{
const int MEMSIZE = 1024*1024*10;
char memblock[MEMSIZE];
memblock[10] = '\0';
printf("%s", memblock);
return 0;
}
Is there some size limit on character arrays? I’ve forgotten all my C, am I doing something stupid here?
There’s no limit on the size of char arrays as such but stack sizes will be relatively constrained compared to available heap memory. You’re probably overflowing the stack here. You could try making
memblockstaticor allocating it dynamically