I can't figure out what's the problem with the following code, it just crashes without outputing anything to the screen:
#include <cstdlib>
#include <iostream>
using namespace std;
typedef struct {
unsigned int recid;
unsigned int num;
char str[120];
bool valid;
} record_t;
typedef struct {
unsigned int blockid;
unsigned int nreserved;
record_t entries[100];
bool valid;
unsigned char misc;
} block_t;
int main(){
cout << "Before Buffer" << endl;
block_t buffer[1000];
cout << "After Buffer" << endl;
return 0;
}
I tried Qt debugger and GBD and they just show segmentation fault and point at the start of the main function.
The size of each block_t element is 13,2 Kbs so the size of the buffer array should be around 13Mb. Maybe that's too much for a C-array?
block_t** b = (block_t**)malloc(sizeof(block_t)*1000);).