I\'m taking a class on C, and running into a segmentation fault. From what I understand, seg faults are supposed to occur when you\'re accessing memory that hasn\'t been all
If it runs correctly elsewhere, you're most likely trying to grab more stack space than the OS allows. You're allocating 4MB on the stack (1 mill integers), which is way too much for allocating "safely" on the stack. malloc() and free() are your best bets here.