I have narrowed down the error to line 137 and this fault:
___chkstk_ms () at /usr/src/debug/gcc-5.3.0-3/libgcc/config/i386/cygwin.S:137
137 /usr/src/debug/gcc-5.3.0-3/libgcc/config/i386/cygwin.S: No such file or directory.
I am not sure how to address this problem. From what I understand ___chkstk_ms() indicates that I am using over the 2MB alloted for the stack. I thought I addressed this issue when I dynamically allocated memory to the array of structs:
processData* aa;
aa = new processData[n];
Below is the code. Thank you in advance for any help.
static int n = 1000;
int i;
int j;
int totalTime = 0;
float averageTurnAroundTime = 0;
float averageWaitTime = 0;
int processQueue[1000];
int timer = 0;
int front = 0;
int end = 0;
int queueCount = 0;
struct processData
{
int arrivalTime;
int durationTime;
int completionTime;
int turnAroundTime;
int waitTime;
int processNumber;
float netTurnAroundTime;
} temp;
It seems likely the problem stems from your use of the non-standard extension that allows variable length arrays.
1 2 3 4 5
void find(struct processData a [])
{
int tempDurationTime[n]; // <-- Here.
int flag = 0;
int count = 0;
It doesn't look large enough to cause an issue to me, but that would be my best guess. Try replacing it with a vector (and doing the same with aa in main would be recommended over manually managing memory.)
Also, you have undefined behavior in the last loop in display. The condition should be i<n.
Why do you have a global variable named i? j? Why do you have so many global variables?