I’m trying to time and compare sorting algorithms. From what I understand: sizeof(int) is 4 bytes, therefore int array[one million]; yields (4) million bytes which is 4,000 kb or 4mb roughly.
So why can’t I? I’m pretty sure I have more. 2gb to be precise.
I’m using gcc if that means anything.
You can’t have that many integers on stack.
Try allocating space on heap for your array.
After you are done with your sorting algorithms, you free the array: