|
|
back to boardCrash (stack overflow). C++ Posted by Nikolay 26 Oct 2008 00:15 #include <stdio.h> #include <math.h> void main(){ int i=0,j=0; double a[128*1024]; while (scanf("%lf",&a[i])!=EOF) i++; for (j=i-1;j>=0;--j){ printf("%.4lf\n",sqrt(double(a[j]))); } } Re: Crash (stack overflow). C++ Use dynamic variable: double *a; a=new double[128*1024] Re: Crash (stack overflow). C++ I can confirm that stack size is 1024k. To open a bigger array, you need to declare it global instead of in main. Wasted me 45 mins Re: Crash (stack overflow). C++ Posted by ahaxzh 4 Aug 2009 20:13 Think U! |
|
|