ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

why stack overflow
Posted by citizenoftheearth 15 Dec 2010 11:31
#include <stdio.h>
#include <math.h>

int main()
{
    double d;
    int n = 0;
    double vect[1024*128];

    while (scanf("%lf", &d) != EOF) vect[n++] = sqrt(d);

    while (--n >= 0) printf("%.5lf\n", vect[n]);

    return 0;
}
Re: why stack overflow
Posted by INNOV.Team 27 Jan 2011 12:13
"double vect[1024*128];"
You can use "malloc" or "new" operator.
Re: why stack overflow
Posted by Maximus 17 Mar 2011 03:05
Or you can allocate memory as a global variable. (Before line: int main(void))