[algogeeks] Fwd: anu_test Segmentation fault

2011-07-03 Thread HARSH PAHUJA
-- Forwarded message -- From: HARSH PAHUJA hpahuja.mn...@gmail.com Date: Sun, Jul 3, 2011 at 8:37 AM Subject: anu_test Segmentation fault To: anutest...@googlegroups.com http://www.ideone.com/QuMcn plzz help. y the above program is giving seg fault #includestdio.h

Re: [algogeeks] Fwd: anu_test Segmentation fault

2011-07-03 Thread Vishal Thanki
Don't allocate too much static memory in stack, it will cause troubles. You are doing int[2000][2000], i.e. 2000*2000*4 bytes of memory in stack. Use dynamic memory allocation for such large chunk. I modified your code as below and it doesn't give seg fault. #includestdio.h #include malloc.h

Re: [algogeeks] Fwd: anu_test Segmentation fault

2011-07-03 Thread Shachin Sharma
You might want to try the following: limit This will show you the stacksize limit (I believe 1024 KB?) Execute the following command unlimit stacksize This should increase the stacksize and make the program work. The second thing is I agree with the fact the such huge static allocation