Dontony's blog

By Dontony, history, 6 years ago, In English

Can we create an array of size 1e6+1 in C++(in my IDE the code crashes),by any methods,or, using vectors would be better? Please comment on this!Thanks.

  • Vote: I like it
  • -12
  • Vote: I do not like it

| Write comment?
»
6 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

I think you should cast it as an integer like (int)(1e6+1). Probably post code for better help :)

»
6 years ago, hide # |
Rev. 2  
Vote: I like it +4 Vote: I do not like it

Declare the array in the global. It's because when you declare variables inside a function, its limited to the stack size. And I think your IDE set the stack size smaller.