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

Run time eror(Stack Overflow)why?
Posted by Chowdhury Md. Ishmam Rahman 1 Oct 2017 23:55
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define SIZE 128*1024
int main()
{
    int i,n=0;
    long long int num[SIZE],N;

printf("enter your aray value:\n");
    while(scanf("%lld",&N)!=EOF)
          {
              num[n]=N;
            n++;
        }

    for(i=n-1;i>=0;i--){

      printf("%0.4lf\n",(double)sqrt(num[i]));
    }
    return 0;
}
Re: Run time eror(Stack Overflow)why?
Posted by Mahilewets Nikita [BSUIR] 2 Oct 2017 21:18
https://ideone.com/yjdxtz
Because you are allocating a large chunk of memory on the call stack
Re: Run time eror(Stack Overflow)why?
Posted by Chowdhury Md. Ishmam Rahman 5 Oct 2017 18:28
ohhh...thanks for your great suggestion.